Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New param for XH.reloadApp() to remove query params #3924

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

Ryanseanlee
Copy link
Contributor

Hoist P/R Checklist

Pull request authors: Review and check off the below. Items that do not apply can also be
checked off to indicate they have been considered. If unclear if a step is relevant, please leave
unchecked and note in comments.

  • Caught up with develop branch as of last change.
  • Added CHANGELOG entry, or determined not required.
  • Reviewed for breaking changes, added breaking-change label + CHANGELOG if so.
  • Updated doc comments / prop-types, or determined not required.
  • Reviewed and tested on Mobile, or determined not required.
  • Created Toolbox branch / PR, or determined not required.

If your change is still a WIP, please use the "Create draft pull request" option in the split
button below to indicate it is not ready yet for a final review.

Pull request reviewers: when merging this P/R, please consider using a squash commit to
collapse multiple intermediate commits into a single commit representing the overall feature
change. This helps keep the commit log clean and easy to scan across releases. PRs containing a
single commit should be rebased when possible.

@Ryanseanlee Ryanseanlee requested a review from amcclain February 21, 2025 01:11
core/XH.ts Outdated
*
* This method will reload the entire application document in the browser - to trigger a
* refresh of the loadable content within the app, use {@link refreshAppAsync} instead.
*/
@action
reloadApp(path?: string) {
reloadApp(path?: string, removeQueryParams: boolean = false) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to call this from the AppContainerModel code that is reloading the page when there is an exception requiring a reload - that's the main case I wanted to catch.

In that use case, we are not spec'ing a path - we want to reload at the current location. We would need to call this as reloadApp(null, true) which is OK but a little sub-optimal.

How about we change the signature to accept a single arg that is either a string - the path, for backwards compatibility - or an object with optional keys path and removeQueryParams:

reloadApp(opts?: string | {path?: string; removeQueryParams?: boolean})

That way if we need to add a new option in the future, we can do so without making more breaking changes. And for the refresh after exception requiring reload, we can call as reloadApp({removeQueryParams: true})

@amcclain amcclain changed the title New param for XH.reloadApp() to remove query params New param for XH.reloadApp() to remove query params Feb 21, 2025
@amcclain amcclain linked an issue Feb 21, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

XH.reloadApp() should strip query params
2 participants