-
Notifications
You must be signed in to change notification settings - Fork 142
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
🐛 [RUM-2280] fix duplicated mutations when using Shadow DOM #2527
🐛 [RUM-2280] fix duplicated mutations when using Shadow DOM #2527
Conversation
@@ -311,6 +311,22 @@ describe('record', () => { | |||
expect(innerMutationData.isChecked).toBe(true) | |||
}) | |||
|
|||
it('should record the change event inside a shadow root only once, regardless if the DOM is serialized multiple times', () => { |
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.
This test is on input
events, as it is easier to test. Mutations are asynchronous and since the original "Shadow Root Controller" was replaced by a new one, calling flushMutations()
did not flush both of them.
Anyway, one test should be enough to avoid regression.
/to-staging |
If you need support, contact us on slack #ci-interfaces! |
/to-staging |
🚂 Branch Integration: starting soon, merge in < 0s Commit db65956ab2 will soon be integrated into staging-50. This build is going to start soon! (estimated merge in less than 0s) you can cancel this operation by commenting your pull request with |
Commit db65956ab2 had already been merged into staging-50 If you need support, contact us on slack #ci-interfaces! |
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.
LGTM
Motivation
Shadow Roots need to be instrumented with a
MutationObserver
and aninput
event listener to properly generate incremental snapshots for changes happening inside of them. We do this instrumentation during serialization.The issue is, when serializing the same Shadow Root multiple times (ex: when a route_change view is created and a second Full Snapshot is taken), Shadow Roots are instrumented multiple times, so inner incremental snapshots are generated multiple times whenever a single change is done.
Changes
Make sure we instrument Shadow Roots only once
Testing
I have gone over the contributing documentation.