Skip to content

Commit 2f58f8e

Browse files
committed
fix edge case with wrong detected removed nodes
1 parent a84d4a3 commit 2f58f8e

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

packages/core/source/elements/RemoteMutationObserver.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,16 @@ export class RemoteMutationObserver extends MutationObserver {
4141

4242
if (record.type === 'childList') {
4343
record.removedNodes.forEach((node) => {
44+
if (!REMOTE_IDS.has(node)) {
45+
/**
46+
* This happens if the node was not recognized during the
47+
* `serializeRemoteNode` of a (probably direct and extensive)
48+
* previous mutation-record (serializeRemoteNode), when it
49+
* was no longer in the DOM at that time of processing.
50+
*/
51+
return;
52+
}
53+
4454
disconnectRemoteNode(node);
4555

4656
remoteRecords.push([

0 commit comments

Comments
 (0)