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
When preloading a route (by hovering on a link for example), the preloaded data is kept in the cache for some time (default is 30 seconds) & no new requests will be made even when hovering on the same link again.
I noticed this behaviour doesn't work as expected when there's a layout in the preloaded route.
Check the reproduction example or the video below:
I've set the defaultStaleTime to 5 seconds, after those 5 seconds, every time I hover on the About link, the layout route loaded is invoked without being cached.
Hover over the 'About' link repeatedly and observe the console logs
You will see the Layout loader message appearing every time you hover on the link without any caching. (Where as the About loader is cached properly)
Expected behavior
The expected behaviour is for the layout routes loaders to be cached like normal routes pages.
The docs don't specify any special treatment for layouts AFAIK.
Which project does this relate to?
Router
Describe the bug
When preloading a route (by hovering on a link for example), the preloaded data is kept in the cache for some time (default is 30 seconds) & no new requests will be made even when hovering on the same link again.
I noticed this behaviour doesn't work as expected when there's a layout in the preloaded route.
Check the reproduction example or the video below:
I've set the
defaultStaleTimeto 5 seconds, after those 5 seconds, every time I hover on the About link, the layout route loaded is invoked without being cached.Recording.2025-05-08.150312.mp4
Your Example Website or App
https://stackblitz.com/edit/github-51knrjza-peyz37du?file=src%2Fmain.tsx
Steps to Reproduce the Bug or Issue
Layout loadermessage appearing every time you hover on the link without any caching. (Where as theAbout loaderis cached properly)Expected behavior
The expected behaviour is for the layout routes loaders to be cached like normal routes pages.
The docs don't specify any special treatment for layouts AFAIK.
Screenshots or Videos
Recording.2025-05-08.150312.mp4
Platform
Additional context
No response