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

KeepAlive doesn't work on pages #15255

Closed
mitow7821 opened this issue Oct 25, 2022 · 7 comments
Closed

KeepAlive doesn't work on pages #15255

mitow7821 opened this issue Oct 25, 2022 · 7 comments

Comments

@mitow7821
Copy link
Contributor

Environment

  • Operating System: Linux
  • Node Version: v16.14.2
  • Nuxt Version: 3.0.0-rc.12
  • Nitro Version: 0.6.0
  • Package Manager: npm@7.17.0
  • Builder: vite
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/github-8d2nyn?file=app.vue,pages%2Findex.vue,pages%2Ftest.vue

  • Click toggle value should change to true
  • Change route to home then go back to test

Describe the bug

Despite of definePageMeta({ keepalive: true, }); test route state isn't cached

Additional context

No response

Logs

No response

@danielroe
Copy link
Member

See #15214. You would not want to set it on just one page or it will not keep the page alive when transitioning to another page that does not have it set. You need to set the config across all pages where keepalive is meant to work, or set it directly via <NuxtPage :keepalive="{}" />.

There is an outstanding issue with include/exclude: #15214.

@danielroe danielroe closed this as not planned Won't fix, can't repro, duplicate, stale Oct 25, 2022
@mitow7821
Copy link
Contributor Author

It's worth to mention about that use case in docs:
https://v3.nuxtjs.org/guide/directory-structure/pages#keepalive

Copy link
Member

Absolutely! A PR would be welcome.

@mitow7821
Copy link
Contributor Author

@danielroe
Copy link
Member

Thanks! ❤️

@freezyh
Copy link

freezyh commented Aug 1, 2023

@danielroe danielroe closed this as not planned

keepalive include/exclude props don't work with

@danielroe
Copy link
Member

See my comment above: there is an issue tracking this. #15255 (comment)

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