-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Suspend mutations during snapshot #385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Yuyz0112
merged 13 commits into
rrweb-io:master
from
statcounter:suspendMutationsDuringSnapshot
Oct 4, 2020
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
a10c2a1
The `processMutations` function needed to be bound to the `mutationBu…
eoghanmurray 321502a
Enable external pausing of mutation buffer emissions
eoghanmurray 18a6a5a
Avoid a build up of duplicate `adds` by delaying pushing to adds unti…
eoghanmurray fcc290d
Need to export freezePage in order to use it from rrweb.min.js
eoghanmurray e8fcfcc
Add a test to check if mutations can be turned off with the `freezePa…
eoghanmurray 33f3104
I noticed out of order ids (in terms of a DOM walk) in a FullSnapshot…
eoghanmurray 2600fe7
Remove attribute modifications from a mutation event that were incorr…
eoghanmurray d2ccbdb
I've manually verified that this empty text node is actually removed …
eoghanmurray a1a5a45
Rearrange when removal happens in order to satisfy tests. I'm also re…
eoghanmurray 1794b5f
As mutations are now paused during FullSnapshots, we shouldn't be cou…
eoghanmurray a263331
Ensure that we clear arrays before emitting, as the mutation could ha…
eoghanmurray c93fbfd
Don't let the programattic pausing during TakeFullSnapshot accidental…
eoghanmurray 1006d8e
Rename paused -> frozen for consistency and change to use getter/sett…
eoghanmurray File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the use case a user should call freeze page manually?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The usecase for Statcounter is that some pages have a constant stream of mutations happening all the time (an image carousel where transitions are controlled by javascript rather than CSS). These generate huge recordings. We've mitigated this by deciding that if there is no user activity on the page, we call
freezePageafter a timeout.A second thing we do is to call freezePage when the page loses focus (
document.addEventListener('visibilitychange')).So I've gone with implementing this as a function call, rather than as a setting (
autoFreezeAfterSecondsor similar), as there may be other use cases I haven't thought of, and I felt like there would need to be two config settings for the above two scenarios, which felt like a harder thing to document.See https://statcounter.com/counter/recorder_uncompressed.js for details on how the two calls are set up; these could be added to documentation as examples if we're gonna keep the
freezePagemethod approach.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cannot open the about link but I do understand the use case now. Thanks!