KeepAlive Dynamic Include Not Restoring State Properly
Version
3.2.33
Reproduction link
Steps to reproduce
- Click the Set Show button in Component 1
- Verify Thing! shows
- Click Toggle button
- Verify Component 2 shows
- Click Toggle button
- Verify Component1 with Thing! shows
- Click Set Show button
- Verify Thing! does not hide
What is expected?
When I click Set Show after performing the above steps, it should hide Thing! from being shown.
What is actually happening?
Set Show is triggered, but the values do not appear to be respected anymore, as Thing! never goes away no matter how many times Set Show is clicked.
In this case the case will be fine. Write it like this and you'll be fine
In yuor case, i debugger the code find the ComponentOne's dep
is disapper.
This may be a bug.
Seems related to https://github.com/vuejs/core/issues/4984 but not sure if it's a duplicate.
As a workaround use a ref for the array and replace the whole array instead of pushing:
activeDialogs.value = activeDialogs.value.concat(name)
@incutonez This case will be fine ☺️.
This issue is fixed by commit.