[M3-10372] - Routing: Full switch + cleanup + remove react-router-dom#12602
[M3-10372] - Routing: Full switch + cleanup + remove react-router-dom#12602cpathipa merged 29 commits intolinode:developfrom
react-router-dom#12602Conversation
| closeMenu, | ||
| display, | ||
| href, | ||
| to, |
There was a problem hiding this comment.
renamed for consistency with router naming conventions
| '/managed/ssh-access', | ||
| '/managed/credentials', | ||
| '/managed/contacts', | ||
| ], |
There was a problem hiding this comment.
This was used to define what children routes should show as active (this is so old and could be solved by using a simple function)
| } | ||
|
|
||
| return isPathOneOf([href, ...activeLinks], locationPathname); | ||
| return to?.split('/')[1] === locationPathname.split('/')[1]; |
There was a problem hiding this comment.
I don't see any issue handling this whole thing with this matching pattern, rather than the complex computing that was done with isPathOneOf and router-dom's matchPath.
| to={to as string} | ||
| style={style} | ||
| title={title} | ||
| {...(to && !shouldOpenInNewTab ? { to: to as _LinkProps['to'] } : {})} |
There was a problem hiding this comment.
The Link was mostly left untouched for the exception of matching the new types.
| order: newOrder, | ||
| orderBy: newOrderBy, | ||
| }), | ||
| }); |
There was a problem hiding this comment.
OrderBy is still useful in a couple places so I just retrofitted it with the new router
| <Router /> | ||
| </ErrorBoundaryFallback> | ||
| ); | ||
| } |
There was a problem hiding this comment.
This is the condition that allows me to use the current auth logic without a deep refactor. I noticed that the way our router handles unauthenticated routes was a bit different and ran into race conditions with the nonce generation.
I believe we will eventually want to move authentication checks closer to the routing engine, as usually recommended (Tanstack has a variety of helpers to do so).
However, for the sake of not introducing extra complexity to this already involved PR, I chose to not move much of the auth logic at all.
packages/manager/src/MainContent.tsx
Outdated
There was a problem hiding this comment.
Same comment as previous regarding Auth
| "react-number-format": "^3.5.0", | ||
| "react-redux": "~7.1.3", | ||
| "react-router-dom": "~5.3.4", | ||
| "react-router-hash-link": "^2.3.1", |
coliu-akamai
left a comment
There was a problem hiding this comment.
thanks Alban! checked a bunch of stuff throughout the app + will continue monitoring after this gets merged. Noticed a few initial things (commented below)
| <Link | ||
| params={{ linodeId }} | ||
| to={`/linodes/$linodeId/networking#${ipTableId}`} |
There was a problem hiding this comment.
noticing a small regression:
| prod | this branch |
|---|---|
view-all-ips-prod.mov |
view-all-ips-this-branch.mov |
| const pagination = usePaginationV2({ | ||
| currentRoute: '/profile/keys', | ||
| initialPage: 1, | ||
| preferenceKey: 'ssh-keys-users-table', | ||
| }); |
There was a problem hiding this comment.
noticed a regression: this component appears in LinodeCreate, LinodeRebuild, and LinodeSettings flows - clicking on a new page or changing pagination size redirects us to /profile/keys instead of staying on whatever flow we're currently on
| import { useLinodeLishQuery, useLinodeQuery } from '@linode/queries'; | ||
| import { CircleProgress, ErrorState } from '@linode/ui'; | ||
| import { styled } from '@mui/material/styles'; | ||
| import { useNavigate, useParams } from '@tanstack/react-router'; |
There was a problem hiding this comment.
Confirmed:
- Analytics events are firing as expected (Adobe and Pendo)
- No regressions with support tickets
- Some general sanity checking with various tabs, sorting, breadcrumbs, search features, browser back/forward buttons but will also keep an eye out once this is in dev
As long as we get pending feedback addressed and this merged after the release branch cut happening today/tomorrow for 8/12, I think this is in a good place.
| url: location.pathname, | ||
| }); | ||
| } | ||
| }, [location.pathname]); // Listen to location changes |
Cloud Manager UI test results🔺 1 failing test on test run #16 ↗︎
Details
TroubleshootingUse this command to re-run the failing tests: pnpm cy:run -s "cypress/e2e/core/account/restricted-user-details-pages.spec.ts" |
|||||||||||||||||
pmakode-akamai
left a comment
There was a problem hiding this comment.
Great work! 🎉👏🏻
I didn't notice any other regressions apart from the ones mentioned in the comments
| An upload is in progress. If you navigate away from this page, the | ||
| upload will be canceled. | ||
| </Typography> | ||
| </ConfirmationDialog> |
There was a problem hiding this comment.
I'm not able to see the navigate-away prompt when an image is uploading (though it works well for Firewalls & Alerts 👏🏻). I'm not quite sure if it should appear when the user navigates away after clicking 'Upload Image', or only before. Just wanted to check if this might be an issue or something we need to handle
There was a problem hiding this comment.
This appears to be matching production behavior and working for me
|
|
||
| React.useEffect(() => { | ||
| if (ipAddressesTableRef.current && location.hash === `#${ipTableId}`) { | ||
| ipAddressesTableRef.current.scrollIntoView({ behavior: 'smooth' }); |
There was a problem hiding this comment.
Based on the latest changes (aside from the "Launch Lish Console" issue), I noticed that the scrollIntoView behavior still doesn't work -- either when the page initially loads or when we're already on the "Network" tab and click "View all IP Addresses." It only seems to work after switching to a different tab and then clicking the link again.



Description 📝
This PR will close the first chapter of the rerouting saga and fully switch Cloud Manager to TanStack router.
Changes 🔄
react-router-domutil instancesreact-router-domreact-router-dompackagePlease see PR self review for more details
Preview 📷
There should be no functional or visual regressions as a result of this PR
How to test 🧪
Verification steps
Note
In order to test this locally, It is a good idea to do a dependency cleanup (pnpm clean) and rebuild your application prior to running things locally, and disable the cache in your browser dev tools' network request tab
Author Checklists
As an Author, to speed up the review process, I considered 🤔
👀 Doing a self review
❔ Our contribution guidelines
🤏 Splitting feature into small PRs
➕ Adding a changeset
🧪 Providing/improving test coverage
🔐 Removing all sensitive information from the code and PR description
🚩 Using a feature flag to protect the release
👣 Providing comprehensive reproduction steps
📑 Providing or updating our documentation
🕛 Scheduling a pair reviewing session
📱 Providing mobile support
♿ Providing accessibility support
As an Author, before moving this PR from Draft to Open, I confirmed ✅