-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
PayloadExtraction/useFetch persists data when it shouldn't #22348
Comments
Start a new pull request in StackBlitz Codeflow. |
You should use |
Not sure how to reopen this. The issue is not fixed by setting route.fullPath or removing the key entirely. |
This isn't exactly related to #22277, but they do share some problems. Setting a specific But to explain why this is only happening when using
The if ((opts._initial || (nuxt.isHydrating && opts._initial !== false)) && hasCachedData()) {
+ asyncData.data.value = getCachedData()
return getCachedData()
} |
Have the exact same problem. |
Thank you for your analysis @94726 hopefully this can get resolved. I haven't met many who has run into this issue, which makes me think I'm following bad practice. Do you have any idea if this is in fact so? From my point of view this is a basic way of fetching. |
@madsh93 to me, the general usecase in your reproduction seems very resonable. I can see myself and others trying something similar when working with paginated queries, for example. But now that I think about it, while this issue is likely a bug, it might be highlighting a missing feature too. useAsyncData(() => route.fullPath, () => $fetch(...)) Most usecases of the |
Something that I had in mind when opening #23000 |
Can confirm this still does not work in 3.8.1 |
Interesting issue. I've used const { data: product } = await useFetch('/api/product', {
key: route.fullPath,
params
}) And locally it works (with build) - but not in stackblitz 🙈 weird-behavior-usefetch-payload.webm |
Hey @manniL Thanks for taking a look. Interesting that it works for you locally on build. In my case it doesn't. I've used your example with useFetch and still on nuxt 3.6.5 (also tested with 3.8.2 with same result) as in the repo I provided. I'm on node v18.17.1 |
Environment
Reproduction
https://stackblitz.com/edit/github-4ym9i1?file=pages%2F%5Bid%5D%2Findex.vue
Describe the bug
To reproduce:
You'll then see the size is not the default size.
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: