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
this.updatedWithError flag is not set on component mount, only on component update, so if the error is triggered on component mount, 2 extra updates are needed instead of one. The first one sets the this.updatedWithError and the second ones resets the state.
react-error-boundary
version: 3.1.0node
version: 12.16.1yarn
version: 1.22.5What you did:
I use
ErrorBoundary
withresetKeys
, with the error being triggered onErrorBoundary
mount. Then I trigger a reset viaresetKeys
What happened:
The
ErrorBoundary
error state is not reset until the secondresetKeys
update.Reproduction repository:
https://codesandbox.io/s/react-error-boundaryignored-update-issue-fcfyi?file=/src/App.js
This is the same code as in Error Recovery example, but with
explode
state initialized astrue
.Try clicking "toggle explode" button right after the initial render: it does not get reset.
Problem description:
this.updatedWithError
flag is not set on component mount, only on component update, so if the error is triggered on component mount, 2 extra updates are needed instead of one. The first one sets thethis.updatedWithError
and the second ones resets the state.Suggested solution:
Adding:
The text was updated successfully, but these errors were encountered: