-
Notifications
You must be signed in to change notification settings - Fork 6
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 #226
Conversation
This fixes an issue where inlined CSS from a remotely loaded `<link>` does not get applied properly due to object reference mutation.
); | ||
const newNode = buildNodeWithSN(newSn, { |
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.
If you look above at the Object.assign
call, you'll see that we mutate the meta object reference from the mirror and pass it to buildNodeWithSN()
. Looking inside of buildNodeWithSN()
you can see that it ends up comparing the same object reference and returning the node from the mirror instead of building a new node.
if (mirror.has(n.id)) {
const nodeInMirror = mirror.getNode(n.id)!;
const meta = mirror.getMeta(nodeInMirror)!;
if (isNodeMetaEqual(meta, n)) return mirror.getNode(n.id);
}
This meant that remote stylesheets were always loaded remotely (even if you inline) and could be blocked by CORS, making the inlined CSS rules unused.
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.
Wild catch!
Includes the following fixes: - fix: remote CSS does not get rebuilt properly ([#226](getsentry/rrweb#226)) - fix(snapshot): Set <link> attributes to null for remote CSS ([#227](getsentry/rrweb#227)) - fix(snapshot): Change to ignore all link[rel="modulepreload"] ([#228](getsentry/rrweb#228))
Includes the following fixes: - fix: remote CSS does not get rebuilt properly ([#226](getsentry/rrweb#226)) - fix(snapshot): Set <link> attributes to null for remote CSS ([#227](getsentry/rrweb#227)) - fix(snapshot): Change to ignore all link[rel="modulepreload"] ([#228](getsentry/rrweb#228))
Includes the following fixes: - fix: remote CSS does not get rebuilt properly ([#226](getsentry/rrweb#226)) - fix(snapshot): Set <link> attributes to null for remote CSS ([#227](getsentry/rrweb#227)) - fix(snapshot): Change to ignore all link[rel="modulepreload"] ([#228](getsentry/rrweb#228))
This fixes an issue where inlined CSS from a remotely loaded
<link>
does not get applied properly due to object reference mutation.