Skip to content

Commit edc52db

Browse files
wfk007mdellanoce
authored andcommitted
perf(rrweb): optimize random shuffled addList
1 parent c3a8d22 commit edc52db

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/rrweb/src/record/mutation.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,13 @@ export default class MutationBuffer {
717717
if (this.processedNodeManager.inOtherBuffer(n, this)) return;
718718

719719
// if n is added to set, there is no need to travel it and its' children again
720-
if (this.addedSet.has(n) || this.movedSet.has(n)) return;
720+
if (this.addedSet.has(n)) {
721+
// update the order of added nodes in addedSet for the `emit` phase
722+
this.addedSet.delete(n);
723+
this.addedSet.add(n);
724+
return;
725+
}
726+
if (this.movedSet.has(n)) return;
721727

722728
if (this.mirror.hasNode(n)) {
723729
if (isIgnored(n, this.mirror)) {

0 commit comments

Comments
 (0)