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:
@@ -147,7 +147,6 @@ function record<T = eventWithTime>(
|
||||
) {
|
||||
// we've got a user initiated event so first we need to apply
|
||||
// all DOM changes that have been buffering during paused state
|
||||
mutationBuffer.emit();
|
||||
mutationBuffer.unfreeze();
|
||||
}
|
||||
|
||||
@@ -182,7 +181,7 @@ function record<T = eventWithTime>(
|
||||
);
|
||||
|
||||
let wasFrozen = mutationBuffer.isFrozen();
|
||||
mutationBuffer.freeze(); // don't allow any mirror modifications during snapshotting
|
||||
mutationBuffer.lock(); // don't allow any mirror modifications during snapshotting
|
||||
const [node, idNodeMap] = snapshot(document, {
|
||||
blockClass,
|
||||
blockSelector,
|
||||
@@ -221,10 +220,7 @@ function record<T = eventWithTime>(
|
||||
},
|
||||
}),
|
||||
);
|
||||
if (!wasFrozen) {
|
||||
mutationBuffer.emit(); // emit anything queued up now
|
||||
mutationBuffer.unfreeze();
|
||||
}
|
||||
mutationBuffer.unlock(); // generate & emit any mutations that happened during snapshotting, as can now apply against the newly built mirror
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user