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
Page component is created twice when navigating to it from page which uses different layout #14573
Comments
In this case, the NuxtLoadingIndicator does not work properly |
This is a huge issue if you have logic running the created/mounted fields as they get run twice. In our case this is fairly destructive. We have a default layout that is used across almost all pages. However within a single page we change the layout using: <script>
export default {
setup() {
definePageMeta({
layout: 'alternate-layout'
});
}
}
</script> This causes the page to be loaded first with the If anyone knows of a work around for this until it's fixed I'm all ears 🦻 |
@deanmikan We got around this with using the <template>
<NuxtLayout name="default">
<div>
someCOntent
</div>
</NuxtLayout>
</template>
<script setup lang="ts">
definePageMeta({
layout: false,
})
</script> Its really painfull but at least the pages are working again on our site |
Ouch. Are you running this on |
!Same thing. I'm so painful |
@deanmikan yes we are working under rc-8 |
this problem already exist in 2019 on nuxt 2, I never thought I'm facing this again on nuxt 3 😭😅 |
I think this is cause by the The update of But use this in If you change the I wonder if it is a solution that you just alias |
I am also getting this error, thus im not changing the page layout at all... |
I can not confirm that this is fixed :/ |
I think this should be opened as it's not fixed. In my case this is happening when navigating from a page with
To a page with layout that also contains a |
Would you open a new issue with a reproduction? 🙏 |
Was there a new issue opened somewhere? I've just encountered this issue after having accessing the app via a domain and Nginx Proxy Manager for the first time. |
I also encountered the same situation, but it was a simple mistake. I was outputting the slot twice within the layout. It's natural for onMounted to be called twice in that case. |
Environment
Linux
v16.15.0
3.0.0-rc.8
npm@8.14.0
vite
modules
,css
,vite
,runtimeConfig
,build
@formkit/nuxt@1.0.0-beta.10
-
Reproduction
https://stackblitz.com/edit/github-nodp3z?file=pages/page.vue
There are two pages and each of them uses a different layout. Just click on link to another page, then click on link to index page. You can see in console that index page component is created and mounted twice.
Describe the bug
If you are navigating using NuxtLink to another page which uses different layout, that page component is created twice.
Additional context
It started happening after upgrade from rc6 to rc7. Still happening on rc8.
I also noticed that await useAsyncData on rc6 does not block navigation when navigating to page with another layout. Layout shows without page, then after page data is loaded, page is mounted. This does not happen on rc7 and rc8, navigation is correctly blocked until data is fetched. Maybe it has something to do with this.
Logs
No response
The text was updated successfully, but these errors were encountered: