Discovered that the common case of mouse movement or scrolling happening during takeFullSnapshot was causing mutations to be immediately emitted, contrary to the goal of https://github.com/rrweb-io/rrweb/pull/385 (#470)
This commit is contained in:
@@ -173,20 +173,33 @@ export default class MutationBuffer {
|
||||
|
||||
public unfreeze() {
|
||||
this.frozen = false;
|
||||
this.emit();
|
||||
}
|
||||
|
||||
public isFrozen() {
|
||||
return this.frozen;
|
||||
}
|
||||
|
||||
public lock() {
|
||||
this.locked = true;
|
||||
}
|
||||
|
||||
public unlock() {
|
||||
this.locked = false;
|
||||
this.emit();
|
||||
}
|
||||
|
||||
public processMutations = (mutations: mutationRecord[]) => {
|
||||
mutations.forEach(this.processMutation);
|
||||
if (!this.frozen) {
|
||||
this.emit();
|
||||
}
|
||||
this.emit();
|
||||
};
|
||||
|
||||
public emit = () => {
|
||||
|
||||
if (this.frozen || this.locked) {
|
||||
return;
|
||||
}
|
||||
|
||||
// delay any modification of the mirror until this function
|
||||
// so that the mirror for takeFullSnapshot doesn't get mutated while it's event is being processed
|
||||
|
||||
|
||||
Reference in New Issue
Block a user