-
Notifications
You must be signed in to change notification settings - Fork 182
BED-5765: Preserve environmentId
query param through links
#1376
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…BED-5765--env-history-bug
…BED-5765--env-history-bug
benwaples
reviewed
Apr 17, 2025
benwaples
reviewed
Apr 17, 2025
Comment on lines
+116
to
+117
...Object.fromEntries(preservedParams), | ||
...Object.fromEntries(baseSearchParams), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!! what a clean way to let passed in params override the existing ones
benwaples
approved these changes
Apr 18, 2025
benwaples
approved these changes
Apr 18, 2025
…BED-5765--env-history-bug
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Adds a new
AppLink
component anduseAppNavigation
hook to be used as drop-in replacements forLink
anduseNavigate
fromreact-router-dom
. These wrappers have additional functionality for preserving any query params that we have defined as globally available (namely ourenvironmentId
params currently).This also adds a boolean prop and config option respectfully called
discardQueryParams
that can optionally be set totrue
if we want to ignore the behavior (such as when navigating back to the login component for an unauthenticated user).We currently only have globally available params in BHE, so there should be no noticeable impact on the behavior of the BHCE app.
Motivation and Context
Resolves BED-5765
Resolves BED-5779
Resolves BED-5770
Previously, we were fetching the
environmentId
from the API and re-applying it to the query param after following a link from one page of the app to another. This would create additional history entries, and then keep creating more as you try to back up through them.This also by necessity cleans up a couple other minor bugs around
environmentId
linked in the above tickets.How Has This Been Tested?
All existing tests pass and I've done quite a bit of manual testing in both apps. I am currently working on some unit tests as well, but since this is a quick fix before our last RC I wanted to get this up for review.
Screenshots (optional):
Types of changes
Checklist: