Fix: Switch to real dom before rebuilding fullsnapshot (#1139)
This commit is contained in:
@@ -491,7 +491,7 @@ function diffChildren(
|
||||
} else if (newStartIndex > newEndIndex) {
|
||||
for (; oldStartIndex <= oldEndIndex; oldStartIndex++) {
|
||||
const node = oldChildren[oldStartIndex];
|
||||
if (!node || !parentNode.contains(node)) continue;
|
||||
if (!node || node.parentNode !== parentNode) continue;
|
||||
try {
|
||||
parentNode.removeChild(node);
|
||||
replayer.mirror.removeNodeFromMap(node);
|
||||
|
||||
@@ -713,6 +713,8 @@ export type CSSStyleDeclaration = Record<string, string> & {
|
||||
};
|
||||
|
||||
function appendChild(parent: IRRNode, newChild: IRRNode) {
|
||||
if (newChild.parentNode) newChild.parentNode.removeChild(newChild);
|
||||
|
||||
if (parent.lastChild) {
|
||||
parent.lastChild.nextSibling = newChild;
|
||||
newChild.previousSibling = parent.lastChild;
|
||||
@@ -740,6 +742,9 @@ function insertBefore(
|
||||
"Failed to execute 'insertBefore' on 'RRNode': The RRNode before which the new node is to be inserted is not a child of this RRNode.",
|
||||
);
|
||||
|
||||
if (newChild === refChild) return newChild;
|
||||
if (newChild.parentNode) newChild.parentNode.removeChild(newChild);
|
||||
|
||||
newChild.previousSibling = refChild.previousSibling;
|
||||
refChild.previousSibling = newChild;
|
||||
newChild.nextSibling = refChild;
|
||||
|
||||
Reference in New Issue
Block a user