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

nested router with nested keepalive will invoke onMouted twice #12017

Open
Dchih opened this issue Sep 24, 2024 · 2 comments · May be fixed by #12042
Open

nested router with nested keepalive will invoke onMouted twice #12017

Dchih opened this issue Sep 24, 2024 · 2 comments · May be fixed by #12042
Labels
🐞 bug Something isn't working scope: keep-alive

Comments

@Dchih
Copy link

Dchih commented Sep 24, 2024

Vue version

^3.4.29

Link to minimal reproduction

https://stackblitz.com/edit/vitejs-vite-otefqw

Steps to reproduce

click switch(切换) button, check console , then you'll see twice output

What is expected?

call onMounted once

What is actually happening?

nested router-view width nested keepalive will cause twice onMounted hook call in inner nested component.
目的是想让 keep-alive 缓存嵌套路由的所有组件,结果发现二层嵌套中 keep-alive 包的组件在首次切换的时候会调用两次 onMounted

System Info

win10
chrome@latest

Any additional comments?

No response

@linzhe141
Copy link
Contributor

linzhe141 commented Sep 24, 2024

@edison1105
Copy link
Member

edison1105 commented Sep 24, 2024

similar to #7280
duplicate of #3937
For more detail see vuejs/router#626

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

Successfully merging a pull request may close this issue.

3 participants