fix(runtime-core): stricter compat root mount check

This commit is contained in:
Evan You
2021-05-27 20:47:46 -04:00
parent 669037277b
commit 32e21333dd
4 changed files with 12 additions and 15 deletions

View File

@@ -472,6 +472,7 @@ function installCompatMount(
}
setupComponent(instance)
vnode.component = instance
vnode.isCompatRoot = true
// $mount & $destroy
// these are defined on ctx and picked up by the $mount/$destroy

View File

@@ -1301,7 +1301,8 @@ function baseCreateRenderer(
) => {
// 2.x compat may pre-creaate the component instance before actually
// mounting
const compatMountInstance = __COMPAT__ && initialVNode.component
const compatMountInstance =
__COMPAT__ && initialVNode.isCompatRoot && initialVNode.component
const instance: ComponentInternalInstance =
compatMountInstance ||
(initialVNode.component = createComponentInstance(

View File

@@ -136,6 +136,11 @@ export interface VNode<
*/
[ReactiveFlags.SKIP]: true
/**
* @internal __COMPAT__ only
*/
isCompatRoot?: true
type: VNodeTypes
props: (VNodeProps & ExtraProps) | null
key: string | number | null