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

(hmr/keep-alive): After hmr, the page cannot be switched normally #7121

Closed
zhulh-dev opened this issue Nov 13, 2022 · 7 comments · Fixed by #7126
Closed

(hmr/keep-alive): After hmr, the page cannot be switched normally #7121

zhulh-dev opened this issue Nov 13, 2022 · 7 comments · Fixed by #7126

Comments

@zhulh-dev
Copy link

zhulh-dev commented Nov 13, 2022

Vue version

3.2.45

Link to minimal reproduction

https://stackblitz.com/edit/vitejs-vite-knceak?file=src%2FDemoA.vue,src%2FApp.vue&terminal=dev

Steps to reproduce

When I do not modify any code, the operation is very normal, and the DemoA page and DemoB page can be switched normally. However, if DemoA.vue or DemoB.vue is modified, the page switching will be invalid and there will be no error message. I have tried many versions. All versions have this problem. After deleting keep-alive, it will be normal

What is expected?

DemoA and DemoB can be opened normally after hmr

What is actually happening?

After hmr, the page cannot be switched normally, just like this page does not exist

System Info

No response

Any additional comments?

No response

@yyx990803
Copy link
Member

yyx990803 commented Nov 14, 2022

Are you sure this is reproducible with the latest version of Vue? The reproduction is working fine for me.

@zhulh-dev
Copy link
Author

Are you sure this is reproducible with the latest version of Vue? The reproduction is working fine for me.

reproduction.mp4

Is there a problem with my node version?

@zhangzhonghe
Copy link
Member

Are you sure this is reproducible with the latest version of Vue? The reproduction is working fine for me.

I can reproduce it. It must be to change DemoA with DemoA displayed, then wait for hmr to finish before switching to DemoB.

@zhangzhonghe
Copy link
Member

It seems to be caused by here:

const oldInnerChild = oldChild && getKeepAliveChild(oldChild)

When hmr is done, the oldInnerChild here is expired.

zhangzhonghe added a commit to zhangzhonghe/core that referenced this issue Nov 14, 2022
zhangzhonghe added a commit to zhangzhonghe/core that referenced this issue Feb 4, 2023
zhangzhonghe added a commit to zhangzhonghe/core that referenced this issue Apr 24, 2023
sxzz pushed a commit to zhangzhonghe/core that referenced this issue Aug 24, 2023
@laterdayi
Copy link

@yyx990803 No updates yet?

@laterdayi
Copy link

vuejs/router#1655

yyx990803 pushed a commit that referenced this issue Nov 9, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Nov 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants
@yyx990803 @zhangzhonghe @zhulh-dev @laterdayi and others