Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

svelte 5 : navigation hanging in prod with cached _data.json #12180

Open
zhihengGet opened this issue May 1, 2024 · 2 comments
Open

svelte 5 : navigation hanging in prod with cached _data.json #12180

zhihengGet opened this issue May 1, 2024 · 2 comments

Comments

@zhihengGet
Copy link

zhihengGet commented May 1, 2024

Describe the bug

everything works locally, but after deployment to cloudflare worker the navigation starts to hang.

if i am on page A, then navigate back to Page B by click on a link cause hanging.

i checked devtool, _data.json file is fetched with status 304 and no response cache-control but navigation does not happen , the response itself is also wrong, i.e /blog/1/_data.json would return the response for /blog/1 which is the response from my database

, the correct response is which i got from local dev: image

in local env, i see status for _data.json after click on link is 200 and the response cache-control is no-store, so in production, i tried disable browser cache which solved the problem,

fixed it by adding a page rule to not cache _data.json path for cf i, but i feel like this is a bug with sveltekit , using cache is fine for _data.json i guess?

fixed it by adding reqeust cache controller header - no store by proxying fetch

if there's any other suggestions would be great..

Reproduction

if you really really really need one, i can try to come up with one but since it is on prod only , it will be a bit hard

Logs

No response

System Info

windows, svelte 5 RC, chrome latest version, kit latest

Severity

serious, but I can work around it

Additional Information

No response

@davidlgj
Copy link

davidlgj commented May 5, 2024

@zhihengGet I'm having a similar issue, _data.json files are cached when I pushed a new release with adapter-static since they don't have a hash in the filename.

I'm curious why did you closed this issue? Did you find a solution?

@zhihengGet
Copy link
Author

zhihengGet commented May 5, 2024

@zhihengGet I'm having a similar issue, _data.json files are cached when I pushed a new release with adapter-static since they don't have a hash in the filename.

I'm curious why you closed this as issue? Did you find a solution?

i think i did it by make sure fetch request has no-store in cache-control, you can refer here on how to handle fetch , #9530 and you can also try adding a cache rule to make sure data.json never cache on cf

@zhihengGet zhihengGet reopened this May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants