Skip to content

Watchers in nested elements in keep alive are called twice #5207

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

Closed
nicolas-t opened this issue Jan 5, 2022 · 3 comments
Closed

Watchers in nested elements in keep alive are called twice #5207

nicolas-t opened this issue Jan 5, 2022 · 3 comments
Labels
🐞 bug Something isn't working scope: keep-alive

Comments

@nicolas-t
Copy link

nicolas-t commented Jan 5, 2022

Version

3.2.26

Reproduction link

code : github.com
demo : netlify.com

Steps to reproduce

  1. Click https://vue-3-watcher-called-twice.netlify.app/home/nested
  2. Open devtools on the console tab.
  3. Click About link.
  4. Click "Modify shared state".

What is expected?

Modifying state should trigger related watchers once.

What is actually happening?

Modifying state triggers related watchers twice.


Related topic :
https://forum.vuejs.org/t/vue-3-watcher-called-twice/125548

@LinusBorg LinusBorg added scope: keep-alive 🐞 bug Something isn't working labels Jan 5, 2022
@nicolas-t nicolas-t changed the title Watchers in nested elements in keet alive are called twice Watchers in nested elements in keep alive are called twice Jan 5, 2022
@yuwu9145
Copy link
Contributor

yuwu9145 commented Jan 18, 2022

This is because when for example "home" is active, keepAlive caches About -> RouterView (RounterView renders NestedHome), it results in two NestedHome instances.
image

@edison1105
Copy link
Member

similar to #5252,
because the children are not cached.

@posva
Copy link
Member

posva commented Jul 19, 2022

Closing in favor of #5386 without vue-router involved

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🐞 bug Something isn't working scope: keep-alive
Projects
None yet
Development

No branches or pull requests

5 participants