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
Error When Fast Navigating "Failed to execute 'insertBefore' on 'Node'" #13350
Comments
Happens for me as well. Even without the |
It happens for me too |
Bug still present on |
Bug still present in latest build:
|
Bug still present on latest: |
Just to be clear, this is an upstream |
We needed to get a presentation-like application tested and testers&customer got stuck spamming the next button. So for the time being, while hoping for a fix, we just reload the page when this error appears. It's a dirty trick 👀 and not recommended, but for now it does the trick to make the application not unresponsive.
|
A lot of time has passed. Are there any solutions? |
@AkioSarkiz |
Strange hyperlink given above, this one should be better: https://stackoverflow.com/questions/70396414/nuxtlink-is-updating-route-in-nuxt-3-app-but-not-rendering-contents/70404764 |
@kissu yes, but I think the problem is different than the one in this issue :) The solution in that link is about using a single root element which has nothing to do with this issue. |
for now I'm overcoming this error with the @vanling example above. const messages = [
`Uncaught NotFoundError: Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node.`, // chromium based
`NotFoundError: The object can not be found here.`, // safari
]
if (typeof window !== 'undefined') {
window.addEventListener('error', (ev) => {
if (messages.includes(ev.message)) {
ev.preventDefault()
window.location.reload()
}
})
} |
and me |
Console error, blank page |
try setting a key to the top level <template>
<NuxtLayout>
<NuxtPage :key="$route.fullPath"/>
</NuxtLayout>
</template> |
@genu's solution is working for me. Thanks. |
Thank you omg, this works, but why. I worked on my website, came back the next day and somehow I got this bug and apparently the key trick fixed it? How did this happen in the first place? Edit: Nevermind, it didn't really fix it. Every time I navigate now it reloads all icons and images again and it glitches a little bit. :( |
Try also not using <template>
<div>
<NuxtLayout>
<NuxtPage :key="$route.fullPath"/>
</NuxtLayout>
</div
</template> Its possible that this breaks regardless of the <template>
<NuxtPage :key="$route.fullPath" />
</template> |
Thank you, works great on Nuxt 3.8.1! Had to slightly tweak the plugin for it to work. In the end I called it import type { Router } from 'vue-router'
interface CustomRouter extends Router {
running?: boolean
nextRoute?: string | null
}
export default defineNuxtPlugin((nuxtApp) => {
const customRouter: CustomRouter = useRouter()
nuxtApp.hook('page:start', () => {
customRouter.running = false
customRouter.beforeEach((to, _from, next) => {
if (customRouter.running) {
next(true)
} else {
customRouter.nextRoute = to.fullPath
next(false)
}
})
})
nuxtApp.hook('page:transition:finish', () => {
customRouter.running = true
if (customRouter.nextRoute) {
customRouter
.push(customRouter.nextRoute)
.then(() => (customRouter.nextRoute = null))
}
})
})
|
@Endermanch Are you really sure it works great on nuxt 3.8.1 ? Beucase I just tried with your solution and it really looked like its working but I didn't stop navigating. After few "fast" route navigations, I reproduced the same error. Sorry. But thank you anyways. 🙏 |
It does for me, here's the showcase: P. S. Don't mind the IDE showing errors, the JetBrains IDE is going wild sometimes |
Do you have any async request on your pages that you navigating around? Edit |
Nope, no async requests. |
async requests are highly increasing the chance of this problem occurs. (almost 70%) |
В моем случае я столкнулся с такими проблемами: <NuxtPage :key="$route.fullPath"/> Поэтому, я использую (костыль?). Я не могу найти точно, где в документации говорится что так делать не рекомендуется. <Transition name="page" mode="out-in">
<div :key="$route.fullPath">
<NuxtPage />
</div>
</Transition> В моем случае это работает, и вроде бы ничего не ломается. |
https://nuxt.com/docs/api/components/nuxt-page#example - тут приведен правильный вариант, потому что использование $route может привести к проблемам с |
@YozhikR @CodeLearningSlayer давайте, пожалуйста, на английском в таких репозиториях. Особенно, когда цель получить помощь или помочь кому-то, вас просто не поймут. |
What seems to be the root cause of this problem is now fixed in VueJS core vuejs/core#8105 |
An unbelievable early Christmas present! 🎁 🎉 |
Vue 3.3.10 was just released 🎉
As this issues was linked to the issue I mentioned, there is a good chance this issue could be resolved by updating Vue to |
Just tested quickly to update vue to 3.3.10, it seems to have fix the issue for me ! |
I'm glad I subscribed to this thread! |
Got an E-Mail Notification for every reply here and after 1 year and 4 months it's finally fixed 🥹 |
Great! I understand the previous answers as confirmation, so I'll go ahead an close this issue 🎉 |
Same here, I can't even remember what brought me here in the first place |
Random unknown issue in console maybe? :D |
Using Nuxt 3.8.2 and still got the error. Using an async $fetch and the layout gets messed up. When removing the transitions or change it to mode: 'default' instead of mode: 'out-in', everything works fine. |
@pdahlenburg Nuxt 3.8.2 does not have the latest version of Vue. Please update Vue or wait for a new version of Nuxt. |
It brings another problem. If you want to add query on your currwnt route, o=full page will be reload |
Works perfectly! Thanks |
If you can reproduce the issue, then please create a new issue (and feel free to link to this one) @IvanWala |
Fixed in this release for me https://github.com/nuxt/nuxt/releases/tag/v3.9.1 |
Still facing this issue while using router.replace with nuxt@3.10.2. |
hi @fedikan - do you happen to have traces of the older vue still in your project? |
Yeah, i have fully cleared node_modules, .nuxt and package-lock. But seems like the issue is related to mounting algorithm changes, or to some hydration problems. Still figuring out :/ |
Environment
Darwin
v17.2.0
3.0.0-27404660.0f9bcbf
yarn@1.22.17
Vite
meta
,css
,plugins
,build
,buildModules
,components
,vite
,intlify
,vueuse
-
@nuxtjs/eslint-module@3.0.2
,@pinia/nuxt@0.1.8
,unplugin-icons/nuxt
,@nuxtjs/svg@0.3.0
,@intlify/nuxt3@0.1.10
,@vueuse/nuxt@7.5.5
,~/modules/tailwind-viewer
Reproduction
Using Minimal Nuxt 3 Template :
https://codesandbox.io/s/loving-feather-utoky
Using My Template :
https://codesandbox.io/s/github/viandwi24/nuxt3-awesome-starter
I tested on both templates above the results are the same
Describe the bug
when navigating too fast an error appears like the log below and the application stops working.
for example when I navigate to the "about" page then quickly navigate again to the "home" page.
like the gif below:
Additional context
No response
Logs
The text was updated successfully, but these errors were encountered: