diff --git a/packages/rrweb/src/record/mutation.ts b/packages/rrweb/src/record/mutation.ts index 525a1af46b..4a2436c262 100644 --- a/packages/rrweb/src/record/mutation.ts +++ b/packages/rrweb/src/record/mutation.ts @@ -717,7 +717,13 @@ export default class MutationBuffer { if (this.processedNodeManager.inOtherBuffer(n, this)) return; // if n is added to set, there is no need to travel it and its' children again - if (this.addedSet.has(n) || this.movedSet.has(n)) return; + if (this.addedSet.has(n)) { + // update the order of added nodes in addedSet for the `emit` phase + this.addedSet.delete(n); + this.addedSet.add(n); + return; + } + if (this.movedSet.has(n)) return; if (this.mirror.hasNode(n)) { if (isIgnored(n, this.mirror)) {