-
Notifications
You must be signed in to change notification settings - Fork 49.3k
Closed
Description
React version: 17.0.1
TL;DR: Fixed with skipUnmountedBoundaries = true
Steps To Reproduce
- Throw in an effect cleanup
- Try to catch it when wrapped in
act()
Link to code example:
React 16
React 17
I also tested it locally and jest and couldn't catch the error as well.
The current behavior
The error is uncatchable and does not include the component stack ("The above error occurred").
The expected behavior
The error is catchable and does include the component stack i.e. React 16 behavior.
Context
I understand that the cleanup is now async but it's still flushed in act()
so I would expect that an error thrown is catchable.
Originally reported in testing-library/react-testing-library#874