From 72115506b12fd0aff7047a755fc89f19d9e8b3f0 Mon Sep 17 00:00:00 2001 From: Luca Casonato Date: Sun, 6 Mar 2022 03:44:47 +0100 Subject: [PATCH] refactor: remove marker comments on hydration (#110) --- src/runtime/main.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/runtime/main.ts b/src/runtime/main.ts index ceb260d1..b77def6d 100644 --- a/src/runtime/main.ts +++ b/src/runtime/main.ts @@ -34,11 +34,16 @@ export function revive(islands: Record) { const tag = node!.nodeType === 8 && ((node as Comment).data.match(/^\s*frsh-(.*)\s*$/) || [])[1]; if (tag) { + const startNode = node!; const children = []; const parent = node!.parentNode; while ((node = node!.nextSibling) && node.nodeType !== 8) { children.push(node); } + startNode.parentNode!.removeChild(startNode); + if (node) { + node.parentNode?.removeChild(node); + } const [id, n] = tag.split(":"); render( h(islands[id], ISLAND_PROPS[Number(n)]),