Skip to content

[M3-10372] - Routing: Full switch + cleanup + remove react-router-dom#12602

Merged
cpathipa merged 29 commits intolinode:developfrom
alioso:M3-10372
Aug 7, 2025
Merged

[M3-10372] - Routing: Full switch + cleanup + remove react-router-dom#12602
cpathipa merged 29 commits intolinode:developfrom
alioso:M3-10372

Conversation

@alioso
Copy link
Copy Markdown
Contributor

@alioso alioso commented Jul 30, 2025

Description 📝

This PR will close the first chapter of the rerouting saga and fully switch Cloud Manager to TanStack router.

Changes 🔄

  • Replace final react-router-dom util instances
  • Tackles TanStack router left over TODOs
  • Remove all references to react-router-dom
  • Remove react-router-dom package
  • Fix utils and e2e units

Please 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

  • Verify application behavior by testing a variety of routes and features
  • Verify signing/in signing out etc (auth in general)
  • Verify table data ordering
  • Verify preloading of data functioning well (ex: PrimaryNav)
  • Verify behavior of active links in PrimaryNav
  • Verify self components mentioned in self review
  • Verify behavior of navigate away prompts (Firewall Rules, ACLP Alerts, Image Upload))
  • Verify Main Search behavior
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

  • I have read and considered all applicable items listed above.

As an Author, before moving this PR from Draft to Open, I confirmed ✅

  • All tests and CI checks are passing
  • TypeScript compilation succeeded without errors
  • Code passes all linting rules

closeMenu,
display,
href,
to,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

renamed for consistency with router naming conventions

'/managed/ssh-access',
'/managed/credentials',
'/managed/contacts',
],
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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];
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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'] } : {})}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The Link was mostly left untouched for the exception of matching the new types.

order: newOrder,
orderBy: newOrderBy,
}),
});
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

OrderBy is still useful in a couple places so I just retrofitted it with the new router

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🧹 🧹 🧹

<Router />
</ErrorBoundaryFallback>
);
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

MainContent 👉 Root

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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",
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

⚰️

@alioso alioso marked this pull request as ready for review July 30, 2025 12:45
@alioso alioso requested review from a team as code owners July 30, 2025 12:45
@alioso alioso requested review from cliu-akamai and cpathipa and removed request for a team July 30, 2025 12:45
Copy link
Copy Markdown
Member

@bnussman-akamai bnussman-akamai left a comment

Choose a reason for hiding this comment

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

Sooo goood. 👏

Confirmed this fixes the "navigation ghosting" we were seeing while having 2 routes in use.

I feel good with merging and monitoring closely!

@github-project-automation github-project-automation bot moved this from Review to Approved in Cloud Manager Aug 6, 2025
Copy link
Copy Markdown
Contributor

@coliu-akamai coliu-akamai left a comment

Choose a reason for hiding this comment

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

thanks Alban! checked a bunch of stuff throughout the app + will continue monitoring after this gets merged. Noticed a few initial things (commented below)

Comment on lines +277 to +279
<Link
params={{ linodeId }}
to={`/linodes/$linodeId/networking#${ipTableId}`}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

noticing a small regression:

prod this branch
view-all-ips-prod.mov
view-all-ips-this-branch.mov

Comment on lines +65 to +69
const pagination = usePaginationV2({
currentRoute: '/profile/keys',
initialPage: 1,
preferenceKey: 'ssh-keys-users-table',
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

clicking on "Launch Lish Console" for a Linode has some changes:

prod this branch
image image

Copy link
Copy Markdown
Contributor

@mjac0bs mjac0bs left a comment

Choose a reason for hiding this comment

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

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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Via the preview link, I'm seeing the AA page view fire as expected with the debugger.

image

@linode-gh-bot
Copy link
Copy Markdown
Collaborator

Cloud Manager UI test results

🔺 1 failing test on test run #16 ↗︎

❌ Failing✅ Passing↪️ Skipped🕐 Duration
1 Failing704 Passing4 Skipped123m 50s

Details

Failing Tests
SpecTest
restricted-user-details-pages.spec.tsCloud Manager Cypress Tests→restricted user details pages » should disable action elements and buttons in the 'Linodes' details page

Troubleshooting

Use this command to re-run the failing tests:

pnpm cy:run -s "cypress/e2e/core/account/restricted-user-details-pages.spec.ts"

Copy link
Copy Markdown
Contributor

@pmakode-akamai pmakode-akamai left a comment

Choose a reason for hiding this comment

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

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>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This appears to be matching production behavior and working for me


React.useEffect(() => {
if (ipAddressesTableRef.current && location.hash === `#${ipTableId}`) {
ipAddressesTableRef.current.scrollIntoView({ behavior: 'smooth' });
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Screen.Recording.2025-08-07.at.6.22.59.PM.mov

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'll address those!

@cpathipa cpathipa merged commit cd2342a into linode:develop Aug 7, 2025
34 of 35 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Merged in Cloud Manager Aug 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

External Contribution PRs opened by outside contributors Routing Refactor

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

8 participants