Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(keepAlive): expose pruneCacheEntry and add key match support on exclude/include changed in pruneCache. #5105

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Riant
Copy link

@Riant Riant commented Dec 14, 2021

So, we can

  1. Delete the cache use this.$refs.keepAlive.pruneCacheEntry('COMPONENT_NAME/KEY');
  2. Include/Exclude components with not only component name but also component key.

…ter 判断,增加对基于 component key 的 match 判断支持,以在 include, exclude 的 watch 回调中提供对应支持
@Riant Riant changed the title feat(keepAlive): expose pruneCacheEntry and add key match support on exclude/include changed. feat(keepAlive): expose pruneCacheEntry and add key match support on exclude/include changed in pruneCache. Dec 14, 2021
@caozhong1996
Copy link
Contributor

caozhong1996 commented Dec 16, 2021

Note: it's very similar to #4339
I love this pr, only a small change which is enough for the demand. But I have a question, it seems that we can control cache via key now, why do we need expose pruneCacheEntry? Can you add some test?

@Riant
Copy link
Author

Riant commented Dec 23, 2021

@caozhong1996

Note: it's very similar to #4339

Yes, there are so many developers need and talk about this feature, and it is strange there is no progress so far. and like what you said, it is smallest, this pr or even a half of this pr is enough.

it seems that we can control cache via key now

Did you mean the key match support in this pr? I just want to provide another way, In my opinion, this.$refs.keepAlive.pruneCacheEntry('xxxx') is more visually and simple then this.exclude = ['xxxx']; this.$nextTick(() => this.exclude = []).

Can you add some test?

I am not good at that, and I will try later.

@huangqian0310
Copy link

@caozhong1996

it seems that we can control cache via key now

Current 3.2 In the 26 version, KeepAlive's exclude still does not support key. When it comes to the effective process of exclude, he will still match the routing name, or is it using other ways to make key control the cache of routing?

@caozhong1996
Copy link
Contributor

Yep, the current version of vue can't. I mean that this pr seems supported, but I haven't really tried😁
https://github.com/vuejs/vue-next/pull/5105/files#diff-28ccce6931cf4b4364f58400b93e2ae8efe180a82f885444bb5704574025a4d0L182-R183

@huangqian0310
Copy link

是的,当前版本的 vue 不能。我的意思是这个公关似乎受支持,但我还没有真正尝试过😁 https://github.com/vuejs/vue-next/pull/5105/files#diff-28ccce6931cf4b4364f58400b93e2ae8efe180a82f885444bb5704574025a4d0L182-R183

I'm sorry to misunderstand your idea

@caozhong1996
Copy link
Contributor

Never mind, bro

@haoqunjiang haoqunjiang added scope: keep-alive version: minor 🍰 p2-nice-to-have Priority 2: this is not breaking anything but nice to have it addressed. labels May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍰 p2-nice-to-have Priority 2: this is not breaking anything but nice to have it addressed. scope: keep-alive version: minor
Projects
Status: Needs Review
Development

Successfully merging this pull request may close these issues.

4 participants