fix(react): Make fallback render types more accurate#7198
fix(react): Make fallback render types more accurate#7198AbhiPrasad merged 2 commits intodevelopfrom
Conversation
lforst
left a comment
There was a problem hiding this comment.
Can we type the state of this component more canonical, ie. coupling the existance of an error to the existence of the componentStack and eventId?
packages/react/src/errorboundary.tsx
Outdated
| element = fallback({ | ||
| error, | ||
| // eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
| componentStack: componentStack!, |
There was a problem hiding this comment.
Just to be clear (absolutely no expert here), we are 100% positive that when error is set in the state, componentStack and eventId are also never null?
There was a problem hiding this comment.
Wait, nevermind, just read the related issue, seems good!
Great suggestion, pushed 6ade121 to address this. |
Awesome. Thanks! |
Replay SDK metrics 🚀Latest data for: 5359ba9
*) pp - percentage points - an absolute difference between two percentages.
Last updated: Thu, 16 Feb 2023 11:21:38 GMT |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
fixes #4190
We set
error,componentStack, andeventIdat the same timesentry-javascript/packages/react/src/errorboundary.tsx
Line 106 in 2bdda84
This means that there is no way for
componentStackandeventIdto benulliferroris defined. Making the TS types more accurate to reflect this.