Skip to content

Commit

Permalink
explicitly reset insertionPoint after morphNode and createNode, becau…
Browse files Browse the repository at this point in the history
…se it could have been moved during.

Co-authored-by: MichaelWest22 <[email protected]>
  • Loading branch information
2 people authored and botandrose committed Feb 8, 2025
1 parent 942b89c commit da783da
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/idiomorph.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,11 +323,21 @@ var Idiomorph = (function () {
ctx,
);
morphNode(movedChild, newChild, ctx);
insertionPoint = movedChild.nextSibling;
continue;
}

// last resort: insert the new node from scratch
createNode(oldParent, newChild, insertionPoint, ctx);
const insertedNode = createNode(
oldParent,
newChild,
insertionPoint,
ctx,
);
// could be null if beforeNodeAdded prevented insertion
if (insertedNode) {
insertionPoint = insertedNode.nextSibling;
}
}

// remove any remaining old nodes that didn't match up with new content
Expand Down

0 comments on commit da783da

Please sign in to comment.