-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(browser): Add unregisterOriginalCallbacks
option to browserApiErrorsIntegration
#16412
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…iErrorsIntegration`
unregisterOriginalCallbacks
option to browserApiErrorsIntegration
size-limit report 📦
|
mydea
approved these changes
May 28, 2025
6 tasks
Lms24
added a commit
to getsentry/sentry-docs
that referenced
this pull request
May 30, 2025
…serApiErrors` integration page (#13859) Documents a new option added via getsentry/sentry-javascript#16412. Also added a troubleshooting section as adding this option was the result of investigating a user-reported SDK issue (getsentry/sentry-javascript#16398) Co-authored-by: Alex Krawiec <[email protected]>
antonpirker
pushed a commit
to getsentry/sentry-docs
that referenced
this pull request
Jun 6, 2025
…serApiErrors` integration page (#13859) Documents a new option added via getsentry/sentry-javascript#16412. Also added a troubleshooting section as adding this option was the result of investigating a user-reported SDK issue (getsentry/sentry-javascript#16398) Co-authored-by: Alex Krawiec <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds an option to fix a very unfortunate, effective double invocation of callbacks on objects inheriting from our
EventTarget.addEventListener
instrumentation (to be found inbrowserApiErrorsIntegration
.By default (without the SDK), adding the same listener to an event target twice results in the listener only being added once and hence only being invoked once:
If however, the SDK is initialized between the two calls, the second call doesn't actually register
myClickListener
but a wrapped version of the listener. Hence, the identities of the listeners differ and they're added twice, resulting in them being invoked twice:This is the reason why sometimes, our SDK can indeed cause for example double button clicks, as reported in #16398.
To fix this, this PR introduces an
unregisterOriginalCallbacks
option to thebrowserApiErrorsIntegration
which affected users can switch on. Doing so will make our instrumentation ofaddEventListener
also callremoveEventListener
on for the original callback. Applied to the example above, it will essentially restore the idempotency ofaddEventListener
. At the same time, it feels very risky to do this so for the time being, we'll keep this (and document it as) opt-in.Usage:
Docs PR: getsentry/sentry-docs#13859
fixes #16398