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
SvelteKit always fetches a new copy of a route's data when navigating to a new page or using sveltekit:prefetch. If the website was built using the static adaptor, we know the data is static and there is no need to refetch and check for updates.
Adopt Next/Nuxt's approach. Instead of writing files out to /api/my-endpoint.json, it could be instead rewritten to /_app/{ BUILD HASH OR TIMESTAMP }/api/my-endpoint.json. Then, developers can simply apply Cache-Control: public, immutable to everything inside of /_app.
Alternatives considered
For a static built, SvelteKit could just keep previous requests in memory and not force a refetch.
Importance
nice to have
Additional Information
No response
The text was updated successfully, but these errors were encountered:
Describe the problem
SvelteKit always fetches a new copy of a route's data when navigating to a new page or using
sveltekit:prefetch
. If the website was built using the static adaptor, we know the data is static and there is no need to refetch and check for updates.If you visit https://svelte-demo.jamcart.io/, use dev tools to throttle the connection, and use the browser's back/forward buttons to navigate, then that delay becomes noticeable. This is not an issue for Next.js (https://react-demo.jamcart.io/), Nuxt.js (https://vue-demo.jamcart.io/), or even just static html (https://astro-demo.jamcart.io/).
Describe the proposed solution
Adopt Next/Nuxt's approach. Instead of writing files out to
/api/my-endpoint.json
, it could be instead rewritten to/_app/{ BUILD HASH OR TIMESTAMP }/api/my-endpoint.json
. Then, developers can simply applyCache-Control: public, immutable
to everything inside of/_app
.Alternatives considered
For a static built, SvelteKit could just keep previous requests in memory and not force a refetch.
Importance
nice to have
Additional Information
No response
The text was updated successfully, but these errors were encountered: