keep-alive include not working for async loaded components #3529
Labels
🔨 p3-minor-bug
Priority 3: this fixes a bug, but is an edge case that only affects very specific usage.
🐞 bug
Something isn't working
scope: keep-alive
Version
3.0.11
Reproduction link
https://github.com/rbonsall-turnto/async-keep-alive-example
Steps to reproduce
In the example, there are 3 tabs that switch between components wrapped in a
<keep-alive>
with aninclude
for 2 of the components.In each tab there is a button to up the count. Click the button in each tab to establish a state change for each component. The number of the count displays in the button.
What is expected?
The 2 components that are in the keep-alive include should main their state when switching between tabs.
The GoodbyeWorldAsync.vue component is not in the include so it should not maintain its state.
What is actually happening?
The HelloWorldAsync.vue component does not maintain its state as expected.
Whereas, the HelloWorld.vue non-async component does maintain its state as expected.
This worked in Vue 2. I discovered the issue after migrating a project to Vue 3.
Interestingly, if the "include" is removed from the
<keep-alive>
, all 3 components maintain their state as expected. So, it appears to work for async components, just not when listed in the<keep-alive>
"include".The text was updated successfully, but these errors were encountered: