We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0e48d10 commit 8436691Copy full SHA for 8436691
packages/rrdom/src/diff.ts
@@ -527,7 +527,15 @@ function diffChildren(
527
let oldChild = oldTree.firstChild;
528
let newChild = newTree.firstChild;
529
while (oldChild !== null && newChild !== null) {
530
+ const { previousSibling } = oldChild;
531
diff(oldChild, newChild, replayer, rrnodeMirror);
532
+
533
+ // If oldChild is detached from oldTree, use its previous sibling to grab the next sibling to continue diffing.
534
+ if (oldChild.parentNode !== oldTree && previousSibling) {
535
+ oldChild = previousSibling.nextSibling;
536
+ continue;
537
+ }
538
539
oldChild = oldChild.nextSibling;
540
newChild = newChild.nextSibling;
541
}
0 commit comments