Skip to content

Commit 794dc0c

Browse files
author
Jack Pope
committed
Fix test gated for forceConcurrentByDefaultForTesting
1 parent 2cb9244 commit 794dc0c

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

packages/react-reconciler/src/__tests__/ReactSuspense-test.internal.js

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -339,12 +339,10 @@ describe('ReactSuspense', () => {
339339
async () => {
340340
const root = ReactDOMClient.createRoot(container);
341341

342-
async function interrupt() {
342+
function interrupt() {
343343
// React has a heuristic to batch all updates that occur within the same
344344
// event. This is a trick to circumvent that heuristic.
345-
await act(() => {
346-
root.render('whatever');
347-
});
345+
ReactDOM.render('whatever', document.createElement('div'));
348346
}
349347

350348
function App({shouldSuspend, step}) {
@@ -360,32 +358,24 @@ describe('ReactSuspense', () => {
360358
);
361359
}
362360

363-
await act(() => {
364-
root.render(null);
365-
});
366-
367361
root.render(<App shouldSuspend={false} step={0} />);
368362
await waitForAll(['A0', 'B0', 'C0']);
369363
expect(container.textContent).toEqual('A0B0C0');
370364

371365
// This update will suspend.
372-
await act(() => {
373-
root.render(<App shouldSuspend={true} step={1} />);
374-
});
366+
root.render(<App shouldSuspend={true} step={1} />);
375367

376368
// Do a bit of work
377369
await waitFor(['A1']);
378370

379371
// Schedule another update. This will have lower priority because it's
380372
// a transition.
381-
React.startTransition(async () => {
382-
await act(() => {
383-
root.render(<App shouldSuspend={false} step={2} />);
384-
});
373+
React.startTransition(() => {
374+
root.render(<App shouldSuspend={false} step={2} />);
385375
});
386376

387377
// Interrupt to trigger a restart.
388-
await interrupt();
378+
interrupt();
389379

390380
await waitFor([
391381
// Should have restarted the first update, because of the interruption

0 commit comments

Comments
 (0)