Replace react-router-dom with react-router#4540
Merged
mproffitt merged 3 commits intoweaveworks:mainfrom Jan 18, 2025
Merged
Conversation
4db2c06 to
054db59
Compare
casibbald
previously approved these changes
Jan 16, 2025
Collaborator
casibbald
left a comment
There was a problem hiding this comment.
I have tested the branch, and UI and elements are functional
4332098 to
8aa39cc
Compare
Contributor
Author
|
Found one broken link to the image repository and removed an accidentally included test suite change |
gusevda
reviewed
Jan 17, 2025
Contributor
gusevda
left a comment
There was a problem hiding this comment.
Great job! I left some comments, most important are in the <SubRouterTabs /> component. Overall looks very good!
This commit rewrites much of the routing to support react-router instead of react-router-dom which is deprecated/removed in version 7. react-router-dom 6 introduced large changes to how navigation was managed. This is compounded by layout changes inside react-router 7. This change addresses the need by reworking the navigation to match the format specified by react-router 6 and 7
- Drop types/react-router - Set all routes to be element instead of Component - Undo convertImage change moved to separate PR - Review comments offer simplification to SubRouterTabs - Fix broken Automations route - Reset and reapply change to AppContext to cleanup redundant changes - As above for CoreContext - Remove typecasting, prettify, lint
01d2732 to
a2622fe
Compare
gusevda
approved these changes
Jan 18, 2025
This was referenced Jan 26, 2025
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What changed?
This commit rewrites much of the routing to support react-router instead of react-router-dom which is deprecated/removed in version 7.
This change moves the router across 2 major versions 5.2.0 to 7.1.1
When moving from react-router-dom 5.2.0 to version 6.x, largescale changes were made to how routing and navigation was managed. The change from 6.x to 7.x further refined this, changing how sub-routes were handled by forcing a split of the
Route(/*)intoRoute -> Route(*)This split introduced breaking changes into how routing is managed by the application.
The change to router also had impacts on how automatic logout was managed as this prevented the sign-in page from completely loading, resulting in a loading icon replacing the
continuebutton.Every care has been taken to ensure all routes and tabs are functional however this is not currently exhaustive.
Why was this change made?
To ensure ongoing and future compatibility with upstream libraries.
How was this change implemented?
By working through the routing to ensure it was upgraded to match
react-router@7.1.1How did you validate the change?
By loading the UI using both
yarn startandtilt upand ensuring in both environments all visible pages and tabs are accessible.By ensuring that all relevant unit tests pass with minimal difference.
One test suite was modified by this change. The
Linktest suite contained invalid / broken test cases that became apparent as a result of the change being made. These have now been corrected for URLs treated as relative links.Release notes
N/A
Documentation Changes
N/A