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

fix(keep-alive): only prune cache if include/exclude not null #11369

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

Conversation

dddssw
Copy link

@dddssw dddssw commented Jul 16, 2024

close #11366

Copy link
Member

@yyx990803 yyx990803 left a 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') &&
Copy link
Member

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))
Copy link
Member

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') &&
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

@dddssw
Copy link
Author

dddssw commented Jul 18, 2024

This is my first time writing test cases, and I'm not sure if I should write it this way.thank

@edison1105
Copy link
Member

/ecosystem-ci run

@vue-bot
Copy link
Contributor

vue-bot commented Jul 19, 2024

📝 Ran ecosystem CI: Open

suite result latest scheduled
language-tools failure failure
nuxt success success
pinia success success
primevue success success
quasar success success
radix-vue success success
router success success
test-utils success success
vant success success
vite-plugin-vue success success
vitepress success success
vue-i18n failure success
vue-macros success success
vuetify success success
vueuse success success
vue-simple-compiler success success

@dddssw dddssw requested a review from yyx990803 August 2, 2024 07:32
Copy link

github-actions bot commented Aug 7, 2024

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 98.8 kB (+59 B) 37.4 kB (+15 B) 33.7 kB (-45 B)
vue.global.prod.js 156 kB (+15 B) 57.2 kB (-13 B) 50.8 kB (-63 B)

Usages

Name Size Gzip Brotli
createApp 54.2 kB (+58 B) 21 kB (+15 B) 19.1 kB (-33 B)
createSSRApp 58.2 kB (+58 B) 22.6 kB (+14 B) 20.7 kB (+58 B)
defineCustomElement 58.8 kB (+48 B) 22.5 kB (+7 B) 20.5 kB (-48 B)
overall 67.8 kB (+67 B) 26 kB (+19 B) 23.7 kB (+82 B)

@edison1105 edison1105 changed the title fix(keep-alive): The value of include is empty string should cache no… fix(keep-alive): The value of include is empty string should cache nothing Aug 12, 2024
@edison1105
Copy link
Member

Copy link

netlify bot commented Aug 12, 2024

Deploy Preview for vue-next-template-explorer failed.

Name Link
🔨 Latest commit f8ce9d6
🔍 Latest deploy log https://app.netlify.com/sites/vue-next-template-explorer/deploys/66b9c92cb3174000081af64a

Copy link

netlify bot commented Aug 12, 2024

Deploy Preview for vue-sfc-playground failed.

Name Link
🔨 Latest commit f8ce9d6
🔍 Latest deploy log https://app.netlify.com/sites/vue-sfc-playground/deploys/66b9c92c9d25510008aebd34

@dddssw
Copy link
Author

dddssw commented Aug 12, 2024

@edison1105 Like that?

@edison1105
Copy link
Member

@edison1105 Like that?

Yes

@edison1105 edison1105 changed the title fix(keep-alive): The value of include is empty string should cache nothing fix(keep-alive): only prune cache if include/exclude not null Aug 12, 2024
@edison1105 edison1105 added the ready for review This PR requires more reviews label Aug 12, 2024
@dddssw
Copy link
Author

dddssw commented Aug 12, 2024

Thank

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants