-
-
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
TypeError: Cannot read properties of null (reading 'parentNode') when navigate from page with NuxtLayout as root node #25214
Comments
Start a new pull request in StackBlitz Codeflow. |
Linking here also this repro from @Aareksio: https://stackblitz.com/edit/github-dbis9a.
|
This comment was marked as off-topic.
This comment was marked as off-topic.
@AndersCV Please refrain from posting comments that don't add additional context like "+1", "me too" or "bump". Instead, just upvote the issue through reactions or provide additional context like a reproduction, a new scenario where it happens or anything else that helps resolving the issue. |
If someone can reproduce it via https://stackblitz.com/github/nuxt-contrib/vue3-ssr-starter/tree/main we could raise it upstream in Vue core |
The issue here is that Workaround is to do this: <template>
+ <div>
<NuxtLayout name="test">
<h1>unable navigate to home page</h1>
</NuxtLayout>
+ </div>
</template> Related: #21759. |
With Vue 3.4.8 parentNode error dissapears, but with 3.4.13 and 3.4.14 error persists |
I spent literally hours looking into this over the weekend! The error in the console was somewhat vague, so didn't give much in the way of insight into this. Is this in any way related to the following appearing repeatedly also?
|
Workaround doesn’t work for me. I suspect it has something to do with swapping layouts. |
The same error happens when you're switching between pages that has the Reproduction here: Try switching fast between the 2 pages before the promise is resolved. Observe error in console. |
I have this in my app.vue and when updating Nuxt to the 3.9.3 version I have the same problem.
|
I have a working website its working pretty fine until upgrading to 3.9.3, now It's not letting go to other pages. Its basically shows this error. I believe this error is not from nuxt but from the Latest Vue version I believe.
I have not changed anything. I have not touched layout. Everything is working before. But now navigating to different pages does not work anymore, after the upgrade. My Solution and How I solve my this ISSUE in my Project:so in my main <template>
+ <NuxtLayout>
<NuxtPage />
+ </NuxtLayout>
</template> and in my pages, instead of using <script setup lang='ts'>
...
+ definePageMeta({
+ layout: 'custom'
+ })
</script>
<template>
- <NuxtLayout name="test">
<h1>unable navigate to home page</h1>
- </NuxtLayout>
</template> |
This comment was marked as off-topic.
This comment was marked as off-topic.
Hi @manniL, I have created a reproduction on vue. The navigation between pages without waiting for Suspense to resolve causes this issue. I'm not sure if this is related to https://stackblitz.com/edit/vitejs-vite-2fvdtp?file=src%2FApp.vue |
I don't have any issue as soon as Vue is <3.4.0 (3.3.13 currently). |
@becem-gharbi Thanks! BTW: vuejs/core#10184 might resolve it 👍 |
Can anyone confirm which specific Vue version + Nuxt version will prevent this in the meantime ? I've tried a few combos without great results. Wrapping layout tags in divs didn't seem to solve it for me as a workaround. |
There is already a comment in this regard above: #25214 (comment) You need Vue {
"pnpm": {
"overrides": {
"vue": "3.4.8"
}
}
} No need to downgrade Nuxt. |
In Nuxt3 after overriding the vue version to 3.4.8, we observe a memory leak in the component when the ssr is enabled. The component has complex logic with watchers and computers. Had someone the same? |
this may not be useful for all adding the following to the redirect page overcomes the issue reloadNuxtApp({
path: `/${orgSlug}/convo`,
force: true,
ttl: 5000
}); if you've only got a couple of layouts with single entry points, you could add this to the first page that loads (remove the path property) see un/inbox@4829afc for ref |
temp hotfix for nuxt/nuxt#25214
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as off-topic.
This comment was marked as off-topic.
@norbertSG @nethriis Please refrain from posting comments that don't add additional context like "+1", "me too" or "bump". Instead, just upvote the issue through reactions or provide additional context like a reproduction, a new scenario where it happens or anything else that helps resolving the issue. |
It would seem that this is indeed linked to layout swapping in some way. Our app breaks when navigating from a page with a layout to a nested page with a different layout. We managed to fix it in a few cases by doing this in the script part: definePageMeta({
- layout: 'custom'
+ layout: false
}); and wrapping our individual pages with NuxtLayout tags like this: <template>
+ <NuxtLayout name="custom">
<!-- our code -->
+ </NuxtLayout>
</template> I don't know if it's the best way but this works for us right now in most components. In others, it simply won't work and keeps on breaking navigation. |
Vue 3.4.20 just landed which inludes vuejs/core#10184 |
Confirming issue being fixed on Vue v3.4.20. "devDependencies": {
"nuxt": "^3.10.1",
"vue": "^3.4.20", /* <-- updated vue version */
}, |
In my case, the issue was fixed by checking the
|
Closing this issue as I believe it's been resolved in Vue v3.4.20. If someone experiences this again, please open a new issue with a reproduction. |
Environment
Reproduction
https://stackblitz.com/edit/nuxt-starter-vhqnzj
Describe the bug
when navigate from page with NuxtLayout as root component to another page with NuxtLayout cause TypeError: Cannot read properties of null (reading 'parentNode').
Adding comment above NuxtLayout and still use NuxtLayout as root node doesn't cause this issue (only works in dev mode).
I believe this bug happened after this specific update in vue v3.4.9
Additional context
condition that's trigger this bug :
condition that's not trigger this bug :
Logs
No response
The text was updated successfully, but these errors were encountered: