-
-
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(Transition): handle KeepAlive child unmount in Transition out-in mode #11778
Conversation
Size ReportBundles
Usages
|
@vue/compiler-core
@vue/compiler-sfc
@vue/compiler-dom
@vue/compiler-ssr
@vue/reactivity
@vue/runtime-dom
@vue/runtime-core
@vue/server-renderer
@vue/shared
vue
@vue/compat
commit: |
/ecosystem-ci run |
📝 Ran ecosystem CI: Open
|
@@ -253,7 +254,9 @@ export function renderComponentRoot( | |||
`that cannot be animated.`, | |||
) | |||
} | |||
root.transition = vnode.transition | |||
root.transition = isMounted |
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 line fixes #10827
@@ -224,6 +224,7 @@ const BaseTransitionImpl: ComponentOptions = { | |||
if (!(instance.job.flags! & SchedulerJobFlags.DISPOSED)) { | |||
instance.update() | |||
} | |||
delete leavingHooks.afterLeave |
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 line fixes problem 1
@@ -267,7 +267,7 @@ const KeepAliveImpl: ComponentOptions = { | |||
pendingCacheKey = null | |||
|
|||
if (!slots.default) { | |||
return null | |||
return (current = null) |
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 line fixes problem 2, but it will lead to #10827 regression.
/ecosystem-ci run |
📝 Ran ecosystem CI: Open
|
close #11775
Problems in #11775
The out-in animation fails when switching from
pc
topa
.pb
andpc
will be unmounted. It is expected that only theafterLeave
ofpc
will be executed, but theafterLeave
ofpb
is also being executed, causingpa
to be rendered twice and resulting in the animation not working as expected. (TheafterLeave
ofpb
should not be executed again)afterLeave
should be destroyed after performed.pc
was removed frominclude
, but it was not unmounted.current
is stillpc
inpruneCacheEntry
, so failed to unmountpc
.current
tonull
when patchingemptyPlaceholder
.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
switchToB
buttonswitchToA
buttonWhen switching from
CompB
toCompA
, the content inCompA
disappears.afterLeave
not to perform.component.subTree
.Thanks to @hooray for providing the reproduction