You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(react)!: Update ErrorBoundarycomponentStack type (#14742)
The principle thing that drove this change was this todo:
https://github.com/getsentry/sentry-javascript/blob/5b773779693cb52c9173c67c42cf2a9e48e927cb/packages/react/src/errorboundary.tsx#L101-L102
Specifically we wanted to remove `null` as a valid state from
`componentStack`, making sure that all exposed public API see it as
`string | undefined`. React always returns a `string` `componentStack`
from the error boundary, so this matches our typings more closely to
react.
By making this change, we can also clean up the `render` logic a little.
Specifically we can check for `state.componentStack === null` to
determine if a fallback is rendered, and then I went ahead and removed
some unnecessary nesting.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@
10
10
11
11
- "You miss 100 percent of the chances you don't take. — Wayne Gretzky" — Michael Scott
12
12
13
-
Work in this release was contributed by @nwalters512, @aloisklink, @arturovt, @benjick, @maximepvrt, and @mstrokin. Thank you for your contributions!
13
+
Work in this release was contributed by @nwalters512, @aloisklink, @arturovt, @benjick, @maximepvrt, @mstrokin, and @kunal-511. Thank you for your contributions!
14
14
15
15
-**feat(solidstart)!: Default to `--import` setup and add `autoInjectServerSentry` ([#14862](https://github.com/getsentry/sentry-javascript/pull/14862))**
Copy file name to clipboardExpand all lines: docs/migration/v8-to-v9.md
+6
Original file line number
Diff line number
Diff line change
@@ -126,6 +126,12 @@ Older Typescript versions _may_ still work, but we will not test them anymore an
126
126
127
127
To customize which files are deleted after upload, define the `filesToDeleteAfterUpload` array with globs.
128
128
129
+
### `@sentry/react`
130
+
131
+
The `componentStack` field in the `ErrorBoundary` component is now typed as `string` instead of `string | null | undefined` for the `onError` and `onReset` lifecycle methods. This more closely matches the actual behavior of React, which always returns a `string` whenever a component stack is available.
132
+
133
+
In the `onUnmount` lifecycle method, the `componentStack` field is now typed as `string | null`. The `componentStack` is `null` when no error has been thrown at time of unmount.
0 commit comments