Skip to content
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 using keepAlive #25751

Closed
vloss3 opened this issue Feb 12, 2024 · 5 comments

Comments

@vloss3
Copy link

vloss3 commented Feb 12, 2024

Environment

Working directory: /home/projects/nuxt-starter-f4vru5
Nuxt project info:

  • Operating System: Linux
  • Node Version: v18.18.0
  • Nuxt Version: 3.10.1
  • CLI Version: 3.10.0
  • Nitro Version: 2.8.1
  • Package Manager: npm@10.2.3
  • Builder: -
  • User Config: devtools
  • Runtime Modules: -
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/nuxt-starter-f4vru5?file=pages%2Findex.vue

Describe the bug

The error TypeError: Cannot read properties of null (reading 'parentNode') appears in the console when navigating between pages if <NuxtPage :keepalive="{ max: 5 }" /> and NuxtLayout are used.
Steps:

  1. Open dev tools console
  2. Navigate between pages, e.g. Index -> Node 1 -> Index
  3. Check the console for errors

Additional context

No response

Logs

chunk-JSACULTC.js?v=017ed9e0:9626 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'parentNode')
    at parentNode (chunk-JSACULTC.js?v=017ed9e0:9626:30)
    at ReactiveEffect.componentUpdateFn [as fn] (chunk-JSACULTC.js?v=017ed9e0:7537:11)
    at ReactiveEffect.run (chunk-JSACULTC.js?v=017ed9e0:430:19)
    at instance.update (chunk-JSACULTC.js?v=017ed9e0:7577:17)
    at callWithErrorHandling (chunk-JSACULTC.js?v=017ed9e0:1651:32)
    at flushJobs (chunk-JSACULTC.js?v=017ed9e0:1858:9)
Copy link

stackblitz bot commented Feb 12, 2024

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@danielroe
Copy link
Member

This is likely an upstream Vue issue.

@vloss3
Copy link
Author

vloss3 commented Feb 13, 2024

Related Vue upstream:
Issue: vuejs/core#10098
PR: vuejs/core#10184

@huang-julien
Copy link
Member

I think a workaround is to set your vue version to 3.4.8 🤔

@vloss3
Copy link
Author

vloss3 commented Feb 26, 2024

Fixed in Vue v3.4.20, refresh package-lock to use the latest Vue version.

@vloss3 vloss3 closed this as completed Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants