refactor: remove marker comments on hydration (#110)
This commit is contained in:
@@ -34,11 +34,16 @@ export function revive(islands: Record<string, ComponentType>) {
|
|||||||
const tag = node!.nodeType === 8 &&
|
const tag = node!.nodeType === 8 &&
|
||||||
((node as Comment).data.match(/^\s*frsh-(.*)\s*$/) || [])[1];
|
((node as Comment).data.match(/^\s*frsh-(.*)\s*$/) || [])[1];
|
||||||
if (tag) {
|
if (tag) {
|
||||||
|
const startNode = node!;
|
||||||
const children = [];
|
const children = [];
|
||||||
const parent = node!.parentNode;
|
const parent = node!.parentNode;
|
||||||
while ((node = node!.nextSibling) && node.nodeType !== 8) {
|
while ((node = node!.nextSibling) && node.nodeType !== 8) {
|
||||||
children.push(node);
|
children.push(node);
|
||||||
}
|
}
|
||||||
|
startNode.parentNode!.removeChild(startNode);
|
||||||
|
if (node) {
|
||||||
|
node.parentNode?.removeChild(node);
|
||||||
|
}
|
||||||
const [id, n] = tag.split(":");
|
const [id, n] = tag.split(":");
|
||||||
render(
|
render(
|
||||||
h(islands[id], ISLAND_PROPS[Number(n)]),
|
h(islands[id], ISLAND_PROPS[Number(n)]),
|
||||||
|
|||||||
Reference in New Issue
Block a user