Skip to content

Commit

Permalink
perf(rrweb): optimize random shuffled addList
Browse files Browse the repository at this point in the history
  • Loading branch information
wfk007 authored and mdellanoce committed Oct 27, 2023
1 parent c2e9f31 commit 6ff93b9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/rrweb/src/record/mutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,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)) {
Expand Down

0 comments on commit 6ff93b9

Please sign in to comment.