Skip to content

refactor(runtime-core): remove the deactivated branch in unmountCompo… #2012

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

Merged
merged 1 commit into from
Sep 2, 2020
Merged

refactor(runtime-core): remove the deactivated branch in unmountCompo… #2012

merged 1 commit into from
Sep 2, 2020

Conversation

zhangzhonghe
Copy link
Member

@zhangzhonghe zhangzhonghe commented Aug 30, 2020

// deactivated hook
if (
  da &&
  !isDeactivated &&
  instance.vnode.shapeFlag & ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE
) {
  queuePostRenderEffect(da, parentSuspense)
}

queuePostRenderEffect(da, parentSuspense)永远都不会被执行,
因为在unmount函数中已经处理过instance.vnode.shapeFlag & ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE为true的情况,
如下为函数unmount中的代码:

if (shapeFlag & ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE) {
  ;(parentComponent!.ctx as KeepAliveContext).deactivate(vnode)
  return
}

@yyx990803 yyx990803 merged commit 0d0970f into vuejs:master Sep 2, 2020
@yyx990803
Copy link
Member

good catch!

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

Successfully merging this pull request may close these issues.

2 participants