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
If I have cache headers set in my server load function
exportasyncfunctionload(params){console.log('LOADING');// const val = params.url.searchParams.get('val');constval=params.url.search;constresult={searchProps: 'Value '+val+' '+' CACHE TEST VALUE === '+i++};params.setHeaders({'cache-control': 'max-age=60'//Vary: 'Cookie'});returnresult;}
the headers work, and the page is cached, but if I start on this page, browse elsewhere, and then hit the back button, the loader re-runs.
The reason appears to be that the initial load of my site renders the entire page (which does have the correct headers), but subsequent navigations fetch a __data.js with the right url attached, so browsing back to it fetches that, which isn't (yet) cached.
the directory above that has a huge project around it, but that directory I've linked to contains a minimal SvelteKit app that reproduces this (ostensible) bug.
@dummdidumm and as I've been discussing with Rich, you'd probably need to NOT serve cached results on subsequent load if a custom vary header were present (or else find some creative way to respect the vary header ... ie record all the Vary'd values along side the ttl, and check them on second request)
Describe the bug
If I have cache headers set in my server load function
the headers work, and the page is cached, but if I start on this page, browse elsewhere, and then hit the back button, the loader re-runs.
The reason appears to be that the initial load of my site renders the entire page (which does have the correct headers), but subsequent navigations fetch a __data.js with the right url attached, so browsing back to it fetches that, which isn't (yet) cached.
Reproduction
The minimal repro is here: https://github.com/arackaf/booklist/tree/special/bug-repro/svelte-kit
the directory above that has a huge project around it, but that directory I've linked to contains a minimal SvelteKit app that reproduces this (ostensible) bug.
It's currently deployed here: https://booklist-svelte-kit.vercel.app/
As you navigate, you'll see fresh calls to fetch __data.json, even when you click back to the starting page, which, again, is not (yet) cached.
Logs
No response
System Info
Severity
serious, but I can work around it
Additional Information
No response
The text was updated successfully, but these errors were encountered: