Add option to force calling matchRoutes() on every render (pre-7.1.4 behaviour) #13387
leeleahulkcs
started this conversation in
Proposals
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
react-router 7.1.4 includes a change to
Optimize route matching by skipping redundant matchRoutes calls when possible
(#12800, #12882). Effectively, this "caches" the first result ofmatchRoutes()
and offers no option to clear or disable this cache.I have an application that dynamically creates a routes structure. This structure is then passed to
createBrowserRouter()
and that return value is passed to<RouterProvider/>
. In the entire application, there is only one instance/call tocreateBrowserRouter()
and<RouterProvider/>
.As of version 7.1.4, the ability to dynamically change the routes without reloading the entire application is no longer possible.
I would like to request that
createBrowserRouter()
be modified to accept flag which (when set truthy) will forcematchRoutes()
to be called (thus reverting to pre-7.1.4 behaviour).The specific line(s) which need to check this flag would be https://github.com/remix-run/react-router/blob/react-router%407.1.4/packages/react-router/lib/hooks.tsx#L538-L548.
Beta Was this translation helpful? Give feedback.
All reactions