-
-
Notifications
You must be signed in to change notification settings - Fork 5k
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
useFetch called twice after layout switching #21798
Comments
For now, you can avoid passing a reactive route slug to useFetch. To resolve, we can look at ensuring the route is synced in layout suspense forks (though this will be tricky). |
thx @danielroe, i modified the stackblitz without any reactive route params in the useFetch. The behavior is still the same. Workaround has no effect.
I was looking at #21585 but i think that does not solve this problem |
@danielroe can you please remove the workaround label, removing the reactivity from useFetch does not make any difference. |
Why not just use I think that fixes the issue for you. |
that's true in this cause, but im using multiable slots in layout or is there a way to pass content to a different slot in layout without using NuxtLayout? |
You can define the In your page, it would be something like <!-- /pages/empty.vue -->
<template>
<NuxtLayout name="empty">
<template #slot1>...</template>
<template #slot2>...</template>
</NuxtLayout>
</template> |
@prashantpalikhe thx for help, but then i have to define it on each page (with default layout). this causes the problem that i loose the keepalive state navigating between default layout pages |
Environment
Nuxt Version: 3.6.1
Reproduction
https://stackblitz.com/edit/nuxt-j8hefc
Describe the bug
useFetch is called twice after the layout changed.
pages/index.vue (called useFetch) -> pages/other (different layout) -> pages/index.vue (called twice useFetch)
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: