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 Jan 16, 2024
1 parent c3a8d22 commit edc52db
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 @@ -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)) {
Expand Down

0 comments on commit edc52db

Please sign in to comment.