Skip to content

Conversation

@AbhiPrasad
Copy link
Member

fixes #4190

We set error, componentStack, and eventId at the same time

this.setState({ error, componentStack, eventId });

This means that there is no way for componentStack and eventId to be null if error is defined. Making the TS types more accurate to reflect this.

@AbhiPrasad AbhiPrasad requested a review from lforst February 16, 2023 10:13
Copy link
Contributor

@lforst lforst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

element = fallback({
error,
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
componentStack: componentStack!,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, nevermind, just read the related issue, seems good!

@AbhiPrasad
Copy link
Member Author

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?

Great suggestion, pushed 6ade121 to address this.

@lforst
Copy link
Contributor

lforst commented Feb 16, 2023

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?

Great suggestion, pushed 6ade121 to address this.

Awesome. Thanks!

@github-actions
Copy link
Contributor

Replay SDK metrics 🚀

Latest data for: 5359ba9
  Plain +Sentry +Replay
Value Value Diff Ratio Value Diff Ratio
LCP 77.44 ms 110.32 ms +32.88 ms +42.45 % 133.06 ms +55.62 ms +71.81 %
CLS 0.06 ms 0.06 ms -0.00 ms -0.11 % 0.06 ms -0.00 ms -0.36 %
CPU 16.86 % 17.38 % +0.52 pp +3.10 % 21.15 % +4.29 pp +25.48 %
JS heap avg 1.94 MB 2 MB +63.6 kB +3.28 % 2.87 MB +935.26 kB +48.28 %
JS heap max 2.3 MB 2.57 MB +270.06 kB +11.72 % 3.36 MB +1.05 MB +45.76 %
netTx 0 B 0 B 0 B n/a 2.2 kB +2.2 kB n/a
netRx 0 B 0 B 0 B n/a 41 B +41 B n/a
netCount 0 0 0 n/a 1 +1 n/a
netTime 0.00 ms 0.00 ms 0.00 ms n/a 79.05 ms +79.05 ms n/a

*) pp - percentage points - an absolute difference between two percentages.
Last updated: Thu, 16 Feb 2023 11:21:38 GMT

@AbhiPrasad AbhiPrasad merged commit 79babe9 into develop Feb 16, 2023
@AbhiPrasad AbhiPrasad deleted the abhi-fallback-render-types branch February 16, 2023 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Types for ErrorBoundary fallback props seems wrong

4 participants