* Flush pending work inside an act() boundary. Drains the microtask queue and * then yields one macrotask tick, so React Query's notifyManager (which can * schedule observer notifications on a timer) and any deferred renders settle * deterministically — microtask-only flushing raced the query→ren
()
| 114 | * deterministically — microtask-only flushing raced the query→render update. |
| 115 | */ |
| 116 | async function flush() { |
| 117 | await act(async () => { |
| 118 | await Promise.resolve() |
| 119 | await Promise.resolve() |
| 120 | await Promise.resolve() |
| 121 | await new Promise<void>((resolve) => setTimeout(resolve, 0)) |
| 122 | }) |
| 123 | } |
| 124 | |
| 125 | /** Repeatedly flush until `predicate` holds or the budget runs out. */ |
| 126 | async function flushUntil(predicate: () => boolean, attempts = 40) { |
no test coverage detected