Subscribe on changes!

KeepAlive Dynamic Include Not Restoring State Properly

avatar
Apr 18th 2022

Version

3.2.33

Reproduction link

sfc.vuejs.org/

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.

avatar
Apr 19th 2022

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.

163940570-643ae1f8-5234-4bda-8f38-ba01a65c25ce

This may be a bug.

avatar
Apr 19th 2022

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)
avatar
Apr 19th 2022
avatar
Apr 19th 2022

Wonderful, thank y'all for the quick responses and workaround!

avatar
Apr 20th 2022

duplicate of #4984

avatar
May 12th 2022

This issue is fixed by commit.

avatar
Jul 19th 2022

This one seems to still be broken