Skip to content

Tests failures in React 19's concurrent mode #1800

Discussion options

You must be logged in to vote

I am working on better concurrent mode support in #1788 but that concerns mainly tests with Suspense element.

Regarding your tests, even in React 18, you should wrap your code that triggers re-renders in act, as it allows React to run sync effects. With React 19 that changes to await act(async () => { ... }) due to concurrent mode.

When you use relevant User Event interactions, as that gives you much more realistic testing, as User Event emits sequence of multiple event for each interaction, e.g. onPressIn, onPress, onPressOut for press and for type it simulates user typing letter by letter with numerous events triggered for each letter.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@williamgurzoni
Comment options

Answer selected by roni-castro-shipt
Comment options

You must be logged in to vote
1 reply
@mdjastrzebski
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants