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-view renders incorrect component with wrapping keep-alive at root #2552

Closed
Labels
bug has PR keep-alive Problem appearing when using keep-alive
Projects

Comments

@zrh122
Copy link
Contributor

zrh122 commented Dec 25, 2018

Version

3.0.2

Reproduction link

https://jsfiddle.net/zrh122/vmopsbeh/

Steps to reproduce

  • click index child1
  • click index child2
  • click home
  • click index child1

What is expected?

index child1 component

What is actually happening?

index child2 component

@posva posva added the bug label Dec 25, 2018
@posva
Copy link
Member

posva commented Dec 25, 2018

Seems to be related to the Wrapper component containing the router-view instead of index.
Adding :key="$route.path" to the root router-view

note to myself: doesn't seem to happen in vanilla Vue: https://jsfiddle.net/u7b4srja/

@posva posva changed the title router-view render incorrect component when kept-alive nested router-view renders incorrect component with wrapping keep-alive at root Dec 25, 2018
@zrh122
Copy link
Contributor Author

zrh122 commented Dec 25, 2018

in the forth step, router-view in the Wrapper component renders cached component index child2.
i am thinking this code https://github.com/vuejs/vue-router/blob/v3.0.2/src/components/view.js#L40 caused this problem, the component tree is activated that means inactive should be false but it is true when i debug.

@posva posva added the keep-alive Problem appearing when using keep-alive label Dec 28, 2018
zrh122 added a commit to zrh122/vue-router that referenced this issue Jan 22, 2019
zrh122 added a commit to zrh122/vue-router that referenced this issue Jan 22, 2019
@posva posva added the has PR label Mar 26, 2019
@posva posva added this to Long term road (high prio, low complex) in Longterm Mar 26, 2019
@posva posva moved this from Long term road (high prio, low complex) to Done in Longterm Apr 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment