Skip to content

Commit

Permalink
refactor(jsx/dom): tweaks delete node.vR timing
Browse files Browse the repository at this point in the history
  • Loading branch information
usualoma committed Aug 18, 2024
1 parent 8e59db7 commit 6ff6eb5
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/jsx/dom/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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
}
}
}
Expand Down Expand Up @@ -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) {
Expand All @@ -416,9 +415,6 @@ const applyNodeObject = (node: NodeObject, container: Container, isNew: boolean)
}
}
}
if (node.vR.length) {
node.vR = []
}
if (node.pP) {
delete node.pP
}
Expand Down

0 comments on commit 6ff6eb5

Please sign in to comment.