Skip to content

fix(runtime-core): fix the issue of passing incorrect parentComponent to patch when KeepAlive is activated #13218

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

@edison1105
Copy link
Member

edison1105 commented Apr 18, 2025

Thanks for the PR, but the reproduction doesn't make sense.

<KeepAlive>
    <Test1 v-if=\"flag\" :key=\"key\" />
    <Test2 v-else :key=\"key\" />
  </KeepAlive>

If the keys of if/else are different, there will be no issue.

@edison1105 edison1105 added the need more info Further information is requested label Apr 18, 2025
@yinhangfeng
Copy link
Author

yinhangfeng commented Apr 18, 2025

Thanks for the PR, but the reproduction doesn't make sense.

<KeepAlive>
    <Test1 v-if=\"flag\" :key=\"key\" />
    <Test2 v-else :key=\"key\" />
  </KeepAlive>

If the keys of if/else are different, there will be no issue.

是的,这个例子是为了复现这个问题特意写的,实际情况下目前除了这样也几乎无法复现这个问题,但传给 patch 的 parentComponent 参数确实错了,主要是目前 patch 基本只在 mount 和 unmount 时使用到了 parentComponent,如果后续代码迭代中 patch 对传入的 parentComponent 有其它的使用方式就有可能会出现问题

Copy link

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 100 kB (+7 B) 38.1 kB (+2 B) 34.4 kB (+34 B)
vue.global.prod.js 158 kB (+7 B) 58.3 kB (+1 B) 51.8 kB (-12 B)

Usages

Name Size Gzip Brotli
createApp (CAPI only) 46.4 kB 18.1 kB 16.6 kB
createApp 54.4 kB 21.2 kB 19.4 kB
createSSRApp 58.6 kB 22.9 kB 20.9 kB
defineCustomElement 59.2 kB 22.7 kB 20.7 kB
overall 68.5 kB (+7 B) 26.3 kB 24 kB (+45 B)

Copy link

pkg-pr-new bot commented Apr 18, 2025

Open in StackBlitz

@vue/compiler-core

npm i https://pkg.pr.new/@vue/compiler-core@13218

@vue/compiler-dom

npm i https://pkg.pr.new/@vue/compiler-dom@13218

@vue/compiler-sfc

npm i https://pkg.pr.new/@vue/compiler-sfc@13218

@vue/compiler-ssr

npm i https://pkg.pr.new/@vue/compiler-ssr@13218

@vue/reactivity

npm i https://pkg.pr.new/@vue/reactivity@13218

@vue/runtime-core

npm i https://pkg.pr.new/@vue/runtime-core@13218

@vue/runtime-dom

npm i https://pkg.pr.new/@vue/runtime-dom@13218

@vue/server-renderer

npm i https://pkg.pr.new/@vue/server-renderer@13218

@vue/shared

npm i https://pkg.pr.new/@vue/shared@13218

@vue/compat

npm i https://pkg.pr.new/@vue/compat@13218

vue

npm i https://pkg.pr.new/vue@13218

commit: 4bf8626

@edison1105
Copy link
Member

/ecosystem-ci run

@vue-bot
Copy link
Contributor

vue-bot commented Apr 18, 2025

📝 Ran ecosystem CI: Open

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

@edison1105 edison1105 added ready to merge The PR is ready to be merged. scope: keep-alive 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. and removed need more info Further information is requested labels Apr 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. ready to merge The PR is ready to be merged. scope: keep-alive
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants