-
Notifications
You must be signed in to change notification settings - Fork 277
Description
Describe the Feature
React batches updates to the underlying native platform using act
helper. We already use that for sync calls to render
, update
and fireEvent
. However, it's common to put side effects updating React component state inside useEffect
. Doing that will produce the dreaded "updates should be wrapped into act(...)" warning. To account for that, React introduced async version of act
in v16.9.
So, to avoid our users wrap their waitFor
and findBy
queries with async act()
, we can wrap waitFor
callback with an async act, so it's done automatically, removing churn when testing React.
Possible Implementations
If we bump the minimum required React version to 16.9, it should be as easy as wrapping wait for with async act
. However, if we want to provide compatibility with older React versions, we'll need to come up with a workaround, because IIRC act
in React 16.8 yells if you try to use it in non-sync way