Re-implement Remix's "seen routes" cache in lazy route discovery for Framework Mode #13910
Replies: 2 comments
-
Adding some related context:
When we had the cache inside the router it applied to any router operation, but when it lives in the framework mode internal hook it's only applying to declarative |
Beta Was this translation helpful? Give feedback.
-
Nevermind - this was a misunderstanding on my part. It turns out we just never cherry pick'd the fix we made in v6 to v7 so v7 just had a regression - fixed in #13911 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
As mentioned in #11977, I'm proposing that the
discoveredPaths
mechanism be brought back intoreact-router
for Framework Mode, to avoid making excessive__manifest
calls in the presence of dynamic path segments.One of the approaches that we use a lot is debouncing via
clientLoader
, and a lot of those implementations use a fetcher that targets routes that have dynamic path segments. Without this cache of seen/resolved routes, this ends up creating a lot of unnecessary__manifest
fetches:Screen_Recording_2025-06-27_at_6.41.07_PM.mp4
Discussing this on Discord with @brophdawg11, the proposed implementation would look something like this:
ie: an additional parameter to
patchRoutesOnNavigation()
that would add the resolved routes to the "resolved" cache and prevent future manifest requests. This parameter could be leveraged by Framework Mode, as it would know ahead of time what the available finite set of routes is.Beta Was this translation helpful? Give feedback.
All reactions