feat(hmr): reload and force slot update on re-render

This commit is contained in:
Evan You
2019-12-12 18:13:59 -05:00
parent ef50c333ce
commit f77ae132e5
7 changed files with 73 additions and 16 deletions

View File

@@ -185,6 +185,15 @@ export function isVNode(value: any): value is VNode {
}
export function isSameVNodeType(n1: VNode, n2: VNode): boolean {
if (
__BUNDLER__ &&
__DEV__ &&
n2.shapeFlag & ShapeFlags.COMPONENT &&
(n2.type as Component).__hmrUpdated
) {
// HMR only: if the component has been hot-updated, force a reload.
return false
}
return n1.type === n2.type && n1.key === n2.key
}