You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Navigating to a route containing hash should not throw 'no route matches url' error.
(routes are already defined at this point with .patchRoutes())
Actual Behavior
After the routes are defined with .patchRoutes(), navigating to a route containing hash (#) is throwing us an error: The same navigation, but to route without hash is working correctly in this scenario.
The text was updated successfully, but these errors were encountered:
Westman18
changed the title
After defining routes with .patchRoutes(), trying to navigate to URL containing #hash is throwing an error
After defining routes with patchRoutes, trying to navigate to URL containing #hash is throwing an error
Mar 7, 2025
Performing a GET navigation is currently subject to some short circuit optimizations because it assumes that there haven't been any mutations that would impact the current state of things. I think there's 2 ways to work around this issue you're currently running into:
Option 1 - Is there a reason you can't do this via patchRoutesOnNavogation?
Doing it there let's the router load them during initial hydration to avoid the current "hydrate a 404, then patch in a new route and navigate" flow.
Option 2 - If you use router.revalidate() after you call router.patchRoutes, that should tell the router that it needs to force a full reload which will pick up on the new routes
I'm using React Router as a...
library
Reproduction
.../mock
route to the URL.../mock#test
).System Info
Used Package Manager
npm
Expected Behavior
Navigating to a route containing hash should not throw 'no route matches url' error.
(routes are already defined at this point with
.patchRoutes()
)Actual Behavior
After the routes are defined with

.patchRoutes()
, navigating to a route containing hash (#) is throwing us an error:The same navigation, but to route without hash is working correctly in this scenario.
The text was updated successfully, but these errors were encountered: