vue icon indicating copy to clipboard operation
vue copied to clipboard

About the max attribute of keep-alive component

Open jp-liu opened this issue 1 year ago • 0 comments

Version

2.7.10

Reproduction link

codesandbox.io

Steps to reproduce

  1. Select 111 tab, switch to 222 tab
  2. Repeat the above operation to the 444 tab, switch max to a value such as 1, 2, 3, all caches exist

What is expected?

When the value of the max attribute is less than the number of components currently cached, it is necessary to prune and remove the redundant cache

What is actually happening?

All the caches exist, and the memory is not the max number of caches, but the number controlled by the previous value, only the first one before is eliminated


When the max attribute of the keep-alive component is changed to a value smaller than the previous limit, the previous cache is still retained. When a new cache component comes in, the max attribute is in effect, but it only determines that the limit is exceeded, and The first cache component is deleted, so that there is still the last max number of caches in memory. I think this may be wrong.

I want to dynamically control through the max attribute, the amount I want to cache

max

jp-liu avatar Aug 29 '22 15:08 jp-liu