Skip to content

fix: inserted styles lost when moving elements #233

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

Conversation

billyvg
Copy link
Member

@billyvg billyvg commented Dec 17, 2024

fix code for nodejs tests
change fix direction to avoid issues with duplicate styles
format issues
swap waitForTimeout for waitForRAF in test that flaked
Add unit tests for new functions
Fix broken test causes by file formatting removing spaced


Co-authored-by: jaj1014 [email protected]
Co-authored-by: jaj1014 [email protected]

billyvg and others added 2 commits December 17, 2024 14:56
fix code for nodejs tests
change fix direction to avoid issues with duplicate styles
format issues
swap waitForTimeout for waitForRAF in test that flaked
Add unit tests for new functions
Fix broken test causes by file formatting removing spaced

---------

Co-authored-by: jaj1014 <[email protected]>
Co-authored-by: jaj1014 <[email protected]>
@billyvg billyvg changed the title fix: inserted styles lost when moving elements (#232) fix: inserted styles lost when moving elements Dec 17, 2024
@billyvg
Copy link
Member Author

billyvg commented Dec 17, 2024

Applying rrweb-io#1357 to our fork

@billyvg billyvg marked this pull request as ready for review December 17, 2024 20:31
@billyvg billyvg requested review from a team and chargome December 17, 2024 20:32
if (!elementCssRules || !elementCssRules.length) return;
// style sheet w/ innerText styles to diff with actual and get only inserted styles
const tempStyleSheet = new CSSStyleSheet();
tempStyleSheet.replaceSync(styleElement.innerText);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be an issue for some safari users: https://caniuse.com/mdn-api_cssstylesheet_replacesync but I'd leave it in.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good callout - I think this is OK for us since rrdom is only used on playback

@billyvg billyvg merged commit 8e9b645 into sentry-v2 Dec 18, 2024
16 checks passed
@billyvg billyvg deleted the feat-merge-upstream-2891c362a3933b81175d8ea250432ff84535176b branch December 18, 2024 16:26
billyvg added a commit to getsentry/sentry that referenced this pull request Jan 7, 2025
We have an org that has a small handful of replays where the replayStepper
causes massive perf issues to the extent that it freezes the browser. I
narrowed it down to the `diff()` code inside of `rrdom` and a recent upstream
PR (getsentry/rrweb#233) seems to have exacerbated the
problem. I have not been able to figure out the root cause for the perf issues,
but it seems to be related to CSS and the mutations that add `style` elements.
We will want to try to identify what exactly in these replays are causing the
perf issues.

In the meantime we can filter out these mutations. Since we are only interested
in generating and extracting the HTML for certain breadcrumb events, the styles
should have no affect on the data we are interested in using.

Closes #82221
billyvg added a commit to getsentry/sentry that referenced this pull request Jan 7, 2025
…83016)

We have an org that has a small handful of replays where the
replayStepper
causes massive perf issues to the extent that it freezes the browser. I
narrowed it down to the `diff()` code inside of `rrdom` and a recent
upstream
PR (getsentry/rrweb#233) seems to have
exacerbated the
problem. I have not been able to figure out the root cause for the perf
issues,
but it seems to be related to CSS and the mutations that add `style`
elements.
We will want to try to identify what exactly in these replays are
causing the
perf issues.

In the meantime we can filter out these mutations. Since we are only
interested
in generating and extracting the HTML for certain breadcrumb events, the
styles
should have no affect on the data we are interested in using.

Closes #82221
billyvg added a commit that referenced this pull request Jan 10, 2025
fix code for nodejs tests
change fix direction to avoid issues with duplicate styles
format issues
swap waitForTimeout for waitForRAF in test that flaked
Add unit tests for new functions
Fix broken test causes by file formatting removing spaced

---------

Co-authored-by: jaj1014 <[email protected]>
Co-authored-by: jaj1014 <[email protected]>
billyvg added a commit that referenced this pull request Jan 14, 2025
fix code for nodejs tests
change fix direction to avoid issues with duplicate styles
format issues
swap waitForTimeout for waitForRAF in test that flaked
Add unit tests for new functions
Fix broken test causes by file formatting removing spaced

---------

Co-authored-by: jaj1014 <[email protected]>
Co-authored-by: jaj1014 <[email protected]>
billyvg added a commit that referenced this pull request Jan 14, 2025
fix code for nodejs tests
change fix direction to avoid issues with duplicate styles
format issues
swap waitForTimeout for waitForRAF in test that flaked
Add unit tests for new functions
Fix broken test causes by file formatting removing spaced

---------

Co-authored-by: jaj1014 <[email protected]>
Co-authored-by: jaj1014 <[email protected]>
andrewshie-sentry pushed a commit to getsentry/sentry that referenced this pull request Jan 22, 2025
…83016)

We have an org that has a small handful of replays where the
replayStepper
causes massive perf issues to the extent that it freezes the browser. I
narrowed it down to the `diff()` code inside of `rrdom` and a recent
upstream
PR (getsentry/rrweb#233) seems to have
exacerbated the
problem. I have not been able to figure out the root cause for the perf
issues,
but it seems to be related to CSS and the mutations that add `style`
elements.
We will want to try to identify what exactly in these replays are
causing the
perf issues.

In the meantime we can filter out these mutations. Since we are only
interested
in generating and extracting the HTML for certain breadcrumb events, the
styles
should have no affect on the data we are interested in using.

Closes #82221
billyvg added a commit that referenced this pull request Jan 23, 2025
fix code for nodejs tests
change fix direction to avoid issues with duplicate styles
format issues
swap waitForTimeout for waitForRAF in test that flaked
Add unit tests for new functions
Fix broken test causes by file formatting removing spaced

---------

Co-authored-by: jaj1014 <[email protected]>
Co-authored-by: jaj1014 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants