-
Notifications
You must be signed in to change notification settings - Fork 1
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(rrweb): external function errors should be tagged #8
Conversation
🦋 Changeset detectedLatest commit: 39adcd9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
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 |
@@ -665,7 +665,9 @@ function initStyleSheetObserver( | |||
adds: [{ rule, index }], | |||
}); | |||
} | |||
return target.apply(thisArg, argumentsList); | |||
return externalFunctionWrapper(() => |
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 only added this to insertRule and deleteRule since those are the ones that seem relevant for styled components. We can probably expand this further, but limiting the scope of the changes for now (though this should be fairly safe).
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.
Agreed could be useful for other areas that we would want to differentiate.
Styled Components depend on the CSS related errors being thrown properly. Currently rrweb uses a Proxy to intercept calls to
window.CSSStyleSheet.prototype.insertRule
and a few other functions. This becomes a problem because rrweb also wraps the error handler around this call, and errors caused by external libraries calling insertRule (for example) are getting caught by rrweb handler.This fix adds an wrapper for these function calls that happen outside of the context of rrweb, and marks the error with an
_external_=true
property. This allows us to differentiate the errors on the SDK and decide which errors to re-throw.Relevant SDK change here: amplitude/Amplitude-TypeScript#763