-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
fix(keep-alive): only prune cache if include/exclude not null #11369
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add a test case for this?
@@ -220,7 +220,8 @@ const KeepAliveImpl: ComponentOptions = { | |||
watch( | |||
() => [props.include, props.exclude], | |||
([include, exclude]) => { | |||
include && pruneCache(name => matches(include, name)) | |||
;(include || typeof include === 'string') && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can just be include != null
@@ -220,7 +220,8 @@ const KeepAliveImpl: ComponentOptions = { | |||
watch( | |||
() => [props.include, props.exclude], | |||
([include, exclude]) => { | |||
include && pruneCache(name => matches(include, name)) | |||
;(include || typeof include === 'string') && | |||
pruneCache(name => matches(include, name)) | |||
exclude && pruneCache(name => !matches(exclude, name)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency, also check for exclude != null
@@ -300,7 +301,8 @@ const KeepAliveImpl: ComponentOptions = { | |||
const { include, exclude, max } = props | |||
|
|||
if ( | |||
(include && (!name || !matches(include, name))) || | |||
((include || typeof include === 'string') && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
This is my first time writing test cases, and I'm not sure if I should write it this way.thank |
/ecosystem-ci run |
📝 Ran ecosystem CI: Open
|
Size ReportBundles
Usages
|
Similarly, |
❌ Deploy Preview for vue-next-template-explorer failed.
|
❌ Deploy Preview for vue-sfc-playground failed.
|
@edison1105 Like that? |
Yes |
Thank |
close #11366