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
{{ message }}
Repository navigation
Hot runtime: an un-awaited async act() never closes; the one-worker check waits for it anyway and names the wrong cause #812
In a one-worker hot run, a file that calls void act(async () => { … }) and never awaits it leaves React's act scope open for every later file on the worker. The next file waits up to the test timeout (5 s by default), then fails with HOT_RESIDENT_UNUSABLE.
This is a real leak, and the check is right to refuse the file. React 18 and 19 close an async act() scope (popActScope) only inside the then of the thenable act() returns (react/cjs/react.development.js, exports.act). An un-awaited call never runs that then. Instrumented on React 19.3.1, the callback's timer fired and the callback finished at 1.5 s, but the scope never closed. With .then() attached and nothing else changed, it closed at 1.5 s and the next file ran normally. Under Jest and per-file isolation the next file gets a fresh React, so nothing carries over. With freshRuntime, or with two or more workers (the pool retires the worker), the next file is unaffected.
The message names the wrong cause. It says "often one that timed out while awaiting act()". It does not mention the un-awaited case, which React flags with "You called act(async () => ...) without await" in the file that did it.
Proposed: name both causes in the HOT_RESIDENT_UNUSABLE message and the troubleshooting entry ("an act() that was not awaited never closes; await it"). Separately, consider whether the check can tell a scope whose callback has settled (which will never close) from one still pending, and skip the wait for the former.
Activity