-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
feat(react): Add support for React 17 Error Boundaries #3532
Conversation
size-limit report
|
Do we need that frame, or can it be dropped? If it can, then we have a mechanism for this in place which we already use for react (note that
I think it's fine to ship it and gather feedback, looks like a fine approach for me personally.
Isn't v17 just an extension of v16? All tests written for v17 should also cover v16 in most of cases, so we shouldn't need to test both versions extensively. |
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.
Just a small nitpick, feel free to ignore if it's not actionable.
React 17 introduces better stack traces from error boundaries. This PR updates the
@sentry/react
error boundary to take advantage of that better component stack trace.The current approach is to create a Sentry event with 2 exceptions. The first is the new React component stack trace offered by the error boundary, and the second is stack trace from standard JS error thrown. So it'll look something like this:
A look inside one of the frames:
I'm willing to change this approach if y'all have better ideas, so please drop feedback as necessary.
Things I still have to check:
Works, but for some reason there they are off by a line sometimes? This actually might be a React issue idkThis happens due to how thecomponentStack
is built by React. A consequence of this is that if you have an empty class component like:the frame that is built will not be useful (won't point to the correct lines). Not sure how to fix this (or if it's worth the bandwidth)
Before submitting a pull request, please take a look at our
Contributing guidelines and verify:
yarn lint
) & (yarn test
).