fix(hmr): force full update on nested child components (#1312)

This commit is contained in:
Carlos Rodrigues
2020-06-12 19:31:56 +01:00
committed by GitHub
parent 4492b88938
commit 8f2a7489b7
3 changed files with 94 additions and 13 deletions

View File

@@ -791,11 +791,18 @@ function baseCreateRenderer(
invokeDirectiveHook(n2, n1, parentComponent, 'beforeUpdate')
}
if (__DEV__ && parentComponent && parentComponent.hmrUpdated) {
// HMR updated, force full diff
patchFlag = 0
optimized = false
dynamicChildren = null
// check if any component of the parent chain has `hmrUpdated`
if (__DEV__ && parentComponent) {
let parent: ComponentInternalInstance | null = parentComponent
do {
if (parent.hmrUpdated) {
// HMR updated, force full diff
patchFlag = 0
optimized = false
dynamicChildren = null
break
}
} while ((parent = parent.parent))
}
if (patchFlag > 0) {