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

How to use it with useAsyncData? #113

Open
nazarii-semeniuk opened this issue Feb 4, 2024 · 1 comment
Open

How to use it with useAsyncData? #113

nazarii-semeniuk opened this issue Feb 4, 2024 · 1 comment

Comments

@nazarii-semeniuk
Copy link

Hi, I can't figure out how to use it with useAsyncData composable.

As I know, when we use useAsyncData, to prevent duplicated requests (on server and client), NUXT passes received data in payload in HTML (script tag with NUXT data). But the service worker caches the HTML page, so it caches the payload too. I added my /api/ calls to navigateFallbackDenylist, but still on every page refresh I'm receiving a page with old data. I can receive new data only on client-side navigation, e.g. if I go to another page and then come back to the previous one.

How can I handle this problem to always receive fresh data on page refresh?

@userquin
Copy link
Member

userquin commented Feb 4, 2024

Any ssr page should also be excluded using navigateFallbackDenylist: check vite-pwa/sveltekit#65 for more details

Check also this PR #108

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