Closed
Description
Which project does this relate to?
Router
Describe the bug
Under certain conditions child route loaders receive stale or cached context data. For example given this structure:
_app.tsx -- which is layout pathless route
_app -- folder
- index.tsx
- $id.tsx
both index and $id routes use context as deps for their loaders, however they receive stale data when we navigate to either of routes, overall behavior is very consistently reproducible, so either I got something wrong with route hierarchy or it's a bug. This is observed both in router and start probjects
Your Example Website or App
Steps to Reproduce the Bug or Issue
- Land on Home (index) route, there are two timestamps visible, one in header accessed via Route.useRouteContext, another in index route that is accessed via Route.useRouterData
- Spam on "Invalidate router" button to ensure both timestamps are updated and loader for index route runs fine. This is expected
- Go to "Link to /1", land on $id route and click on the same Invalidate router button, timestamp from loaderData is not updated, in console we see that loader runs on every invalidate call, however it receives old data as context
- Go to Home, now index route is also broken and gets old ctx data when clicking on Invalidate data
Expected behavior
As a user, I expect to receive fresh and latest ctx as my loader args, imagine having auth checks or some server-side stored user prefs that we use as deps for other loaders calls
Screenshots or Videos
No response
Platform
- Router / Start Version: 1.123.0
- OS: Windows
- Browser: Chrome 137, Firefox 139
- Bundler: Vite
- Bundler Version: 6.3.5
Additional context
No response
Metadata
Metadata
Assignees
Labels
No labels