Subscribe on changes!

`KeepAlive include` remove `deactive component` should remove the component from keep-alive storageContainer

avatar
Jan 14th 2022

Version

3.2.26

Reproduction link

sfc.vuejs.org/

Steps to reproduce

  1. click show comp2 button to show comp2
  2. click remove keep-alive comp1 button to remove comp1 from keep-alive include
  3. KeepAlive‘s storageContainer still have comp1.element

中文:

  1. 点击' show comp2 '按钮显示组件' comp2 '
  2. 点击' remove keep-alive comp1 '按钮从keep-alive include中移除' comp1 '
  3. KeepAlive的storageContainer还存在comp1的element

What is expected?

storage container remove comp1.element

What is actually happening?

storage container still have comp1.element


一个组件 deactivated 后 ,将其从 KeepAlive的include 中删除,KeepAlive的storageContainer不会删除此组件的element,导致此组件无法回收,造成内存泄漏。

When a component is deactivated, delete it from the KeepAlive include too. But the KeepAlive storageContainer still contains a element of the component, which causes memory leak.