-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
fix(react): Remove unnecessary withScope wrapper in captureReact #20123
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| import { captureException, withScope } from '@sentry/browser'; | ||
| import { captureException } from '@sentry/browser'; | ||
| import { isError } from '@sentry/core'; | ||
| import type { ErrorInfo } from 'react'; | ||
| import { version } from 'react'; | ||
|
|
@@ -64,10 +64,7 @@ export function captureReactException( | |
| setCause(error, errorBoundaryError); | ||
| } | ||
|
|
||
| return withScope(scope => { | ||
| scope.setContext('react', { componentStack }); | ||
| return captureException(error, hint); | ||
| }); | ||
| return captureException(error, hint); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix PR missing regression test for the changeLow Severity Per project review rules, a Triggered by project rule: PR Review Guidelines for Cursor Bot Reviewed by Cursor Bugbot for commit ef55354. Configure here. |
||
| } | ||
|
|
||
| /** | ||
|
Comment on lines
+67
to
70
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Removing the Suggested FixRestore the Prompt for AI AgentDid we get this right? 👍 / 👎 to inform future reviews. |
||
|
|
||


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.
Removal of
componentStackcontext data from Sentry eventsHigh Severity
Removing the
withScopewrapper also removed thescope.setContext('react', { componentStack })call, which means the React component stack is no longer attached as structured context data on Sentry events. For React < 17, non-Error throws, or whencomponentStackis falsy (where thesetCauselinked-error approach doesn't apply), the component stack is now completely lost. Multiple existing tests inerrorboundary.test.tsxassert thatscopeSetContextSpyis called with thereactcontext — those will now fail.Reviewed by Cursor Bugbot for commit ef55354. Configure here.