fix(runtime-core): fix mouting of detached static vnode

fix #4023
This commit is contained in:
Evan You 2021-07-01 16:11:50 -04:00
parent d2df28dca4
commit fded1e8dfa

View File

@ -686,14 +686,16 @@ function baseCreateRenderer(
hostInsert(anchor!, container, nextSibling) hostInsert(anchor!, container, nextSibling)
} }
const removeStaticNode = ({ el, anchor }: VNode) => { const removeStaticNode = (vnode: VNode) => {
let next let next
let { el, anchor } = vnode
while (el && el !== anchor) { while (el && el !== anchor) {
next = hostNextSibling(el) next = hostNextSibling(el)
hostRemove(el) hostRemove(el)
el = next el = next
} }
hostRemove(anchor!) hostRemove(anchor!)
vnode.el = vnode.anchor = null
} }
const processElement = ( const processElement = (