From 6ff6eb523011df8b0e26a5e7b6d2daa86b2e812f Mon Sep 17 00:00:00 2001 From: Taku Amano Date: Sun, 18 Aug 2024 18:38:48 +0900 Subject: [PATCH] refactor(jsx/dom): tweaks `delete node.vR` timing --- src/jsx/dom/render.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/jsx/dom/render.ts b/src/jsx/dom/render.ts index b19e0711e2..76415d0200 100644 --- a/src/jsx/dom/render.ts +++ b/src/jsx/dom/render.ts @@ -263,6 +263,8 @@ const getNextChildren = ( ): void => { if (node.vR?.length) { childrenToRemove.push(...node.vR) + // eslint-disable-next-line @typescript-eslint/no-explicit-any + delete (node as any).vR } if (typeof node.tag === 'function') { node[DOM_STASH][1][STASH_EFFECT]?.forEach((data: EffectData) => callbacks.push(data)) @@ -285,6 +287,8 @@ const getNextChildren = ( nextChildren.push(child) if (child.vR?.length) { childrenToRemove.push(...child.vR) + // eslint-disable-next-line @typescript-eslint/no-explicit-any + delete (child as any).vR } } } @@ -394,11 +398,6 @@ const applyNodeObject = (node: NodeObject, container: Container, isNew: boolean) : document.createElement(child.tag as string) applyProps(el as HTMLElement, child.props, child.pP) applyNodeObject(child, el as HTMLElement, isNewLocal) - if (child.vR.length) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - delete (child as any).vR - delete child.pP - } } } if (child.tag === HONO_PORTAL_ELEMENT) { @@ -416,9 +415,6 @@ const applyNodeObject = (node: NodeObject, container: Container, isNew: boolean) } } } - if (node.vR.length) { - node.vR = [] - } if (node.pP) { delete node.pP }