feat: Add buttons to switch environments to non-prod banner #2916
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.
Scope
No ticket. I just got annoyed having to keep typing things like "dev-blue.mbtace.com".
Implementation
Screenshots
How to test
Navigate to any page on the website locally, ideally one with a complicated path, like this schedule finder 2.0 one, and then click one of the env buttons on the banner. That should take you to the same page, but in the environment you selected.
Minor Pitfall
Because this uses the
@connobject when the layout is rendered, actions that change the URL without a full page refresh will sometimes cause the buttons to navigate to the page that you originally navigated to, rather than the page than what you'd expect based on the URL.For instance, in SF2.0, if you change the route, stop, or direction, those are live-patches, not true navigations, which means that the buttons won't get updated.
If you run into this, you can simply refresh the page and then try the buttons again.
(If these buttons were intended to be used in production, then that would change my thinking on this, but because these buttons won't be visible to riders, I don't think it's worth to effort to fix this right now.)