fix(runtime-dom): fix static node content caching edge cases

reverts fded1e8

fix #4023, #4031, #4037
This commit is contained in:
Evan You
2021-07-01 19:17:07 -04:00
parent 347d90173b
commit ba89ca9eca
5 changed files with 48 additions and 50 deletions

View File

@@ -134,10 +134,10 @@ export function createHydrationFunctions(
// if the static vnode has its content stripped during build,
// adopt it from the server-rendered HTML.
const needToAdoptContent = !(vnode.children as string).length
for (let i = 0; i < vnode.staticCount; i++) {
for (let i = 0; i < vnode.staticCount!; i++) {
if (needToAdoptContent)
vnode.children += (nextNode as Element).outerHTML
if (i === vnode.staticCount - 1) {
if (i === vnode.staticCount! - 1) {
vnode.anchor = nextNode
}
nextNode = nextSibling(nextNode)!