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(Transition): handle KeepAlive child unmount in Transition out-in mode #11833

Merged
merged 11 commits into from
Sep 6, 2024

Conversation

edison1105
Copy link
Member

@edison1105 edison1105 commented Sep 6, 2024

close #11775

Problems in #11775

  1. The out-in animation fails when switching from pc to pa.

    • Cause: Both pb and pc will be unmounted. It is expected that only the afterLeave of pc will be executed, but the afterLeave of pb is also being executed, causing pa to be rendered twice and resulting in the animation not working as expected. (The afterLeave of pb should not be executed again)
    • Solution: afterLeave should be destroyed after performed.
  2. pc was removed from include, but it was not unmounted.

    • Cause: current is still pc in pruneCacheEntry, so failed to unmount pc.
    • Solution: set current to null when patching emptyPlaceholder.

Problem in #10827

While fixing problem 2, I recalled a previous bug, #10827. At that time, it was determined that #10632 caused it, so #10632 was reverted, and the issues related to #10632 were re-fixed. Fixing problem 2 is equivalent to bringing #10632 back, so bug #10827 needs to be re-investigated.

  • Minimal reproduction

  • Steps to reproduce

    • click switchToB button
    • click switchToA button
  • When switching from CompB to CompA, the content in CompA disappears.

    • Cause: The wrong transition was inherited, causing afterLeave not to perform.
    • Solution: If the component is already mounted, inherit the transition from component.subTree. will cause [3.5.2] Transition stopped working after 3116553 #11829
    • New Solution: also update vnode.transition during setTransitionHooks to component.subTree

Thanks to @hooray for providing the reproduction

Copy link

github-actions bot commented Sep 6, 2024

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 100 kB (+30 B) 37.7 kB 34 kB (+58 B)
vue.global.prod.js 159 kB (+30 B) 57.6 kB 51.3 kB (-10 B)

Usages

Name Size Gzip Brotli
createApp 55.3 kB (+12 B) 21.3 kB (+8 B) 19.4 kB (+38 B)
createSSRApp 59.3 kB (+12 B) 23 kB (+22 B) 20.9 kB (+30 B)
defineCustomElement 60 kB (+12 B) 22.8 kB (+11 B) 20.8 kB (+62 B)
overall 69 kB (+30 B) 26.3 kB (-1 B) 24 kB (-30 B)

Copy link

pkg-pr-new bot commented Sep 6, 2024

Open in Stackblitz

@vue/compiler-core

pnpm add https://pkg.pr.new/@vue/compiler-core@11833

@vue/compiler-dom

pnpm add https://pkg.pr.new/@vue/compiler-dom@11833

@vue/compiler-sfc

pnpm add https://pkg.pr.new/@vue/compiler-sfc@11833

@vue/compiler-ssr

pnpm add https://pkg.pr.new/@vue/compiler-ssr@11833

@vue/runtime-core

pnpm add https://pkg.pr.new/@vue/runtime-core@11833

@vue/runtime-dom

pnpm add https://pkg.pr.new/@vue/runtime-dom@11833

@vue/server-renderer

pnpm add https://pkg.pr.new/@vue/server-renderer@11833

@vue/shared

pnpm add https://pkg.pr.new/@vue/shared@11833

vue

pnpm add https://pkg.pr.new/vue@11833

@vue/compat

pnpm add https://pkg.pr.new/@vue/compat@11833

@vue/reactivity

pnpm add https://pkg.pr.new/@vue/reactivity@11833

commit: 6ef639f

@edison1105
Copy link
Member Author

/ecosystem-ci run

@vue-bot
Copy link
Contributor

vue-bot commented Sep 6, 2024

📝 Ran ecosystem CI: Open

suite result latest scheduled
language-tools failure failure
nuxt success failure
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

@yyx990803 yyx990803 merged commit 6b7901d into main Sep 6, 2024
15 checks passed
@yyx990803 yyx990803 deleted the edison/fix/11775 branch September 6, 2024 03:03
@@ -515,6 +516,7 @@ function getInnerChild(vnode: VNode): VNode | undefined {

export function setTransitionHooks(vnode: VNode, hooks: TransitionHooks): void {
if (vnode.shapeFlag & ShapeFlags.COMPONENT && vnode.component) {
vnode.transition = hooks
Copy link
Member Author

Choose a reason for hiding this comment

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

fix #10827 and will not cause #11829

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