fix(runtime-core): fix parent el update on nested HOC self-update (#1360)

fix #1357
This commit is contained in:
underfin
2020-06-16 04:46:29 +08:00
committed by GitHub
parent be69beed5e
commit 6c8bfa1018
2 changed files with 47 additions and 1 deletions

View File

@@ -1216,6 +1216,7 @@ function baseCreateRenderer(
// no update needed. just copy over properties
n2.component = n1.component
n2.el = n1.el
instance.vnode = n2
}
}
@@ -1304,6 +1305,7 @@ function baseCreateRenderer(
// This is triggered by mutation of component's own state (next: null)
// OR parent calling processComponent (next: VNode)
let { next, bu, u, parent, vnode } = instance
let originNext = next
let vnodeHook: VNodeHook | null | undefined
if (__DEV__) {
pushWarningContext(next || instance.vnode)
@@ -1355,7 +1357,7 @@ function baseCreateRenderer(
endMeasure(instance, `patch`)
}
next.el = nextTree.el
if (next === null) {
if (originNext === null) {
// self-triggered update. In case of HOC, update parent component
// vnode el. HOC is indicated by parent instance's subTree pointing
// to child component's vnode