Skip to content
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

fix: remote CSS does not get rebuilt properly #1618

Merged

Conversation

billyvg
Copy link
Contributor

@billyvg billyvg commented Jan 6, 2025

This fixes an issue where inlined CSS from a remotely loaded <link> does not get applied properly due to object reference mutation.

This fixes an issue where inlined CSS from a remotely loaded `<link>` does not get applied properly due to object reference mutation.
Copy link

changeset-bot bot commented Jan 6, 2025

🦋 Changeset detected

Latest commit: f398551

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 19 packages
Name Type
rrweb Patch
rrweb-snapshot Patch
rrdom Patch
rrdom-nodejs Patch
rrweb-player Patch
@rrweb/all Patch
@rrweb/replay Patch
@rrweb/record Patch
@rrweb/types Patch
@rrweb/packer Patch
@rrweb/utils Patch
@rrweb/web-extension Patch
rrvideo Patch
@rrweb/rrweb-plugin-console-record Patch
@rrweb/rrweb-plugin-console-replay Patch
@rrweb/rrweb-plugin-sequential-id-record Patch
@rrweb/rrweb-plugin-sequential-id-replay Patch
@rrweb/rrweb-plugin-canvas-webrtc-record Patch
@rrweb/rrweb-plugin-canvas-webrtc-replay Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@eoghanmurray
Copy link
Contributor

I can't make changes directly on this branch;

Would you be able to

  • add a changeset
  • cherry-pick the following commit so that the tests pass: c8b0595

@eoghanmurray
Copy link
Contributor

The Object.assign bit was introduced in #995
I'm wondering if it had special significance there in terms of how the link element is updated ... have pinged Yun.

@YunFeng0817
Copy link
Member

@billyvg The only difference is that Object.assign overwrites the attribute value in the mirror. Your change does not change the meta in the mirror.
Can you please help me understand why this difference can cause the bug?

@billyvg
Copy link
Contributor Author

billyvg commented Jan 14, 2025

@YunFeng0817 Yeah so I'm not sure if we are relying on changing the meta in the mirror elsewhere. The reason for this change is as follows:

@YunFeng0817
Copy link
Member

@billyvg Thank you for the clean explanation. I now understand the cause of the issue.
buildNodeWithSN() is called with the meta from mirror I made this for preventing duplicate nodes in the replayer. But a remotely loaded is an exception for the check.

Can you add

Object.assign(
  newSn.attributes,
  mutation.attributes as attributes,
);

to the place after the newNode is created? This can keep the mirror sync with Dom status

@billyvg
Copy link
Contributor Author

billyvg commented Jan 20, 2025

@YunFeng0817 Updated!

Copy link
Member

@YunFeng0817 YunFeng0817 left a comment

Choose a reason for hiding this comment

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

LGTM

@YunFeng0817 YunFeng0817 merged commit 79837ac into rrweb-io:master Jan 20, 2025
6 checks passed
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.

3 participants