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 4, 2023
1 parent 58c9104 commit 33fe6fa
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 @@ -699,7 +699,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 33fe6fa

Please sign in to comment.