mirror of https://github.com/vuejs/core.git
fix: ensure self anchor is inserted during hydration
This commit is contained in:
parent
5ba35e7bc2
commit
8ea4ab1f1f
|
@ -74,9 +74,8 @@ const vaporInteropImpl: Omit<
|
|||
'vdomMount' | 'vdomUnmount' | 'vdomSlot'
|
||||
> = {
|
||||
mount(vnode, container, anchor, parentComponent) {
|
||||
let selfAnchor: Node | null = null
|
||||
let selfAnchor = (vnode.el = vnode.anchor = createTextNode())
|
||||
if (!isHydrating) {
|
||||
selfAnchor = vnode.el = vnode.anchor = createTextNode()
|
||||
container.insertBefore(selfAnchor, anchor)
|
||||
}
|
||||
const prev = currentInstance
|
||||
|
@ -120,6 +119,12 @@ const vaporInteropImpl: Omit<
|
|||
vnode.transition as VaporTransitionHooks,
|
||||
)
|
||||
}
|
||||
if (isHydrating) {
|
||||
// insert self anchor after hydration completed to avoid mismatching
|
||||
;(instance.m || (instance.m = [])).push(() => {
|
||||
container.insertBefore(selfAnchor, anchor)
|
||||
})
|
||||
}
|
||||
mountComponent(instance, container, selfAnchor)
|
||||
simpleSetCurrentInstance(prev)
|
||||
return instance
|
||||
|
@ -142,7 +147,7 @@ const vaporInteropImpl: Omit<
|
|||
} else if (vnode.vb) {
|
||||
remove(vnode.vb, container)
|
||||
}
|
||||
if (vnode.anchor) remove(vnode.anchor as Node, container)
|
||||
remove(vnode.anchor as Node, container)
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue