From 62cd5af08e2ac8b1d4691e75252487083cf7a4aa Mon Sep 17 00:00:00 2001 From: Andrew Clark Date: Wed, 8 Mar 2023 16:40:23 -0500 Subject: [PATCH] Codemod redundant async act scopes (#26350) Prior to #26347, our internal `act` API (not the public API) behaved differently depending on whether the scope function returned a promise (i.e. was an async function), for historical reasons that no longer apply. Now that this is fixed, I've codemodded all async act scopes that don't contain an await to be sync. No pressing motivation other than it looks nicer and the codemod was easy. Might help avoid confusion for new contributors who see async act scopes with nothing async inside and infer it must be like that for a reason. --- .../__tests__/ReactInternalTestUtils-test.js | 2 +- .../src/__tests__/ReactFlight-test.js | 4 +- .../ReactHooksInspectionIntegration-test.js | 14 +- .../ReactDOMConsoleErrorReporting-test.js | 48 ++-- .../src/__tests__/ReactDOMFiberAsync-test.js | 16 +- .../src/__tests__/ReactDOMFizzServer-test.js | 220 ++++++++--------- ...actDOMFizzSuppressHydrationWarning-test.js | 24 +- .../src/__tests__/ReactDOMHooks-test.js | 2 +- .../ReactDOMNativeEventHeuristic-test.js | 16 +- .../__tests__/ReactDOMNestedEvents-test.js | 4 +- .../src/__tests__/ReactDOMRoot-test.js | 10 +- .../ReactDOMSafariMicrotaskBug-test.js | 6 +- ...DOMServerPartialHydration-test.internal.js | 54 ++--- ...MServerSelectiveHydration-test.internal.js | 18 +- .../ReactDOMServerSuspense-test.internal.js | 2 +- .../ReactDOMSuspensePlaceholder-test.js | 6 +- .../ReactErrorBoundaries-test.internal.js | 2 +- .../src/__tests__/ReactUpdates-test.js | 6 +- .../__tests__/ReactWrongReturnPointer-test.js | 6 +- .../ReactDOMServerIntegrationTestUtils.js | 4 +- .../DOMPluginEventSystem-test.internal.js | 26 +- .../__tests__/ChangeEventPlugin-test.js | 4 +- .../__tests__/SimpleEventPlugin-test.js | 16 +- .../__tests__/useFocusWithin-test.internal.js | 14 +- .../__tests__/ReactFabric-test.internal.js | 70 +++--- .../ReactFabricHostComponent-test.internal.js | 4 +- .../src/__tests__/ReactCPUSuspense-test.js | 6 +- .../src/__tests__/ReactCache-test.js | 226 +++++++++--------- .../ReactClassSetStateCallback-test.js | 4 +- .../ReactConcurrentErrorRecovery-test.js | 26 +- .../__tests__/ReactContextPropagation-test.js | 56 ++--- .../src/__tests__/ReactDeferredValue-test.js | 6 +- .../src/__tests__/ReactEffectOrdering-test.js | 8 +- .../src/__tests__/ReactExpiration-test.js | 12 +- .../src/__tests__/ReactFlushSync-test.js | 10 +- .../src/__tests__/ReactHooks-test.internal.js | 90 +++---- .../ReactHooksWithNoopRenderer-test.js | 162 ++++++------- ...tIncrementalErrorHandling-test.internal.js | 6 +- .../ReactIncrementalScheduling-test.js | 2 +- .../__tests__/ReactIncrementalUpdates-test.js | 14 +- .../__tests__/ReactInterleavedUpdates-test.js | 4 +- .../src/__tests__/ReactMemo-test.js | 18 +- .../__tests__/ReactNoopRendererAct-test.js | 4 +- .../src/__tests__/ReactOffscreen-test.js | 190 +++++++-------- .../ReactOffscreenStrictMode-test.js | 16 +- .../__tests__/ReactOffscreenSuspense-test.js | 26 +- .../ReactSchedulerIntegration-test.js | 4 +- .../ReactSubtreeFlagsWarning-test.js | 4 +- .../__tests__/ReactSuspense-test.internal.js | 34 +-- .../ReactSuspenseEffectsSemantics-test.js | 112 ++++----- .../ReactSuspenseEffectsSemanticsDOM-test.js | 14 +- .../ReactSuspenseFuzz-test.internal.js | 2 +- .../src/__tests__/ReactSuspenseList-test.js | 14 +- .../ReactSuspenseWithNoopRenderer-test.js | 108 ++++----- .../src/__tests__/ReactThenable-test.js | 102 ++++---- .../src/__tests__/ReactTransition-test.js | 50 ++-- .../__tests__/ReactTransitionTracing-test.js | 16 +- .../src/__tests__/ReactUpdatePriority-test.js | 4 +- .../__tests__/ReactUpdaters-test.internal.js | 24 +- .../src/__tests__/StrictEffectsMode-test.js | 48 ++-- ...StrictEffectsModeDefaults-test.internal.js | 50 ++-- .../src/__tests__/useEffectEvent-test.js | 60 +++-- .../src/__tests__/useMemoCache-test.js | 26 +- .../useMutableSource-test.internal.js | 32 +-- .../useMutableSourceHydration-test.js | 4 +- .../src/__tests__/useRef-test.internal.js | 26 +- .../__tests__/useSyncExternalStore-test.js | 6 +- .../src/__tests__/ReactFresh-test.js | 12 +- .../ReactFlightDOMRelay-test.internal.js | 2 +- .../src/__tests__/ReactFlightDOM-test.js | 44 ++-- .../__tests__/ReactFlightDOMBrowser-test.js | 44 ++-- .../__tests__/ReactProfiler-test.internal.js | 64 ++--- .../__tests__/ReactStartTransition-test.js | 6 +- .../ReactStrictMode-test.internal.js | 8 +- .../src/__tests__/ReactStrictMode-test.js | 16 +- .../src/__tests__/useSubscription-test.js | 52 ++-- .../useSyncExternalStoreNative-test.js | 8 +- .../useSyncExternalStoreShared-test.js | 82 +++---- 78 files changed, 1277 insertions(+), 1285 deletions(-) diff --git a/packages/internal-test-utils/__tests__/ReactInternalTestUtils-test.js b/packages/internal-test-utils/__tests__/ReactInternalTestUtils-test.js index e561c9b3dbbe2..0b9cc1f252f79 100644 --- a/packages/internal-test-utils/__tests__/ReactInternalTestUtils-test.js +++ b/packages/internal-test-utils/__tests__/ReactInternalTestUtils-test.js @@ -152,7 +152,7 @@ describe('ReactInternalTestUtils', () => { } const root = ReactNoop.createRoot(); - await act(async () => { + await act(() => { root.render(); }); assertLog(['A', 'B', 'C']); diff --git a/packages/react-client/src/__tests__/ReactFlight-test.js b/packages/react-client/src/__tests__/ReactFlight-test.js index 50608dcca5e3e..0e507876d965b 100644 --- a/packages/react-client/src/__tests__/ReactFlight-test.js +++ b/packages/react-client/src/__tests__/ReactFlight-test.js @@ -475,7 +475,7 @@ describe('ReactFlight', () => { return use(promise); } - await act(async () => { + await act(() => { startTransition(() => { ReactNoop.render( <> @@ -554,7 +554,7 @@ describe('ReactFlight', () => { return use(promise); } - await act(async () => { + await act(() => { startTransition(() => { ReactNoop.render( diff --git a/packages/react-debug-tools/src/__tests__/ReactHooksInspectionIntegration-test.js b/packages/react-debug-tools/src/__tests__/ReactHooksInspectionIntegration-test.js index 118a961767ec3..2c7597a6551dd 100644 --- a/packages/react-debug-tools/src/__tests__/ReactHooksInspectionIntegration-test.js +++ b/packages/react-debug-tools/src/__tests__/ReactHooksInspectionIntegration-test.js @@ -61,7 +61,7 @@ describe('ReactHooksInspectionIntegration', () => { const {onMouseDown: setStateA, onMouseUp: setStateB} = renderer.root.findByType('div').props; - await act(async () => setStateA('Hi')); + await act(() => setStateA('Hi')); childFiber = renderer.root.findByType(Foo)._currentFiber(); tree = ReactDebugTools.inspectHooksOfFiber(childFiber); @@ -83,7 +83,7 @@ describe('ReactHooksInspectionIntegration', () => { }, ]); - await act(async () => setStateB('world!')); + await act(() => setStateB('world!')); childFiber = renderer.root.findByType(Foo)._currentFiber(); tree = ReactDebugTools.inspectHooksOfFiber(childFiber); @@ -141,7 +141,7 @@ describe('ReactHooksInspectionIntegration', () => { ); } let renderer; - await act(async () => { + await act(() => { renderer = ReactTestRenderer.create(); }); @@ -203,7 +203,7 @@ describe('ReactHooksInspectionIntegration', () => { }, ]); - await act(async () => { + await act(() => { updateStates(); }); @@ -301,7 +301,7 @@ describe('ReactHooksInspectionIntegration', () => { ); } let renderer; - await act(async () => { + await act(() => { renderer = ReactTestRenderer.create(); }); @@ -370,7 +370,7 @@ describe('ReactHooksInspectionIntegration', () => { }, ]); - await act(async () => { + await act(() => { updateStates(); }); @@ -984,7 +984,7 @@ describe('ReactHooksInspectionIntegration', () => { children: ['count: ', '1'], }); - await act(async () => incrementCount()); + await act(() => incrementCount()); expect(renderer.toJSON()).toEqual({ type: 'div', props: {}, diff --git a/packages/react-dom/src/__tests__/ReactDOMConsoleErrorReporting-test.js b/packages/react-dom/src/__tests__/ReactDOMConsoleErrorReporting-test.js index d4cc22e44668a..9ce6d9676141a 100644 --- a/packages/react-dom/src/__tests__/ReactDOMConsoleErrorReporting-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMConsoleErrorReporting-test.js @@ -72,11 +72,11 @@ describe('ReactDOMConsoleErrorReporting', () => { } const root = ReactDOMClient.createRoot(container); - await act(async () => { + await act(() => { root.render(); }); - await act(async () => { + await act(() => { container.firstChild.dispatchEvent( new MouseEvent('click', { bubbles: true, @@ -146,7 +146,7 @@ describe('ReactDOMConsoleErrorReporting', () => { // Check next render doesn't throw. windowOnError.mockReset(); console.error.mockReset(); - await act(async () => { + await act(() => { root.render(); }); expect(container.textContent).toBe('OK'); @@ -229,7 +229,7 @@ describe('ReactDOMConsoleErrorReporting', () => { // Check next render doesn't throw. windowOnError.mockReset(); console.error.mockReset(); - await act(async () => { + await act(() => { root.render(); }); expect(container.textContent).toBe('OK'); @@ -247,7 +247,7 @@ describe('ReactDOMConsoleErrorReporting', () => { } const root = ReactDOMClient.createRoot(container); - await act(async () => { + await act(() => { root.render( @@ -315,7 +315,7 @@ describe('ReactDOMConsoleErrorReporting', () => { // Check next render doesn't throw. windowOnError.mockReset(); console.error.mockReset(); - await act(async () => { + await act(() => { root.render(); }); expect(container.textContent).toBe('OK'); @@ -384,7 +384,7 @@ describe('ReactDOMConsoleErrorReporting', () => { // Check next render doesn't throw. windowOnError.mockReset(); console.error.mockReset(); - await act(async () => { + await act(() => { root.render(); }); expect(container.textContent).toBe('OK'); @@ -405,7 +405,7 @@ describe('ReactDOMConsoleErrorReporting', () => { } const root = ReactDOMClient.createRoot(container); - await act(async () => { + await act(() => { root.render( @@ -456,7 +456,7 @@ describe('ReactDOMConsoleErrorReporting', () => { // Check next render doesn't throw. windowOnError.mockReset(); console.error.mockReset(); - await act(async () => { + await act(() => { root.render(); }); expect(container.textContent).toBe('OK'); @@ -525,7 +525,7 @@ describe('ReactDOMConsoleErrorReporting', () => { // Check next render doesn't throw. windowOnError.mockReset(); console.error.mockReset(); - await act(async () => { + await act(() => { root.render(); }); expect(container.textContent).toBe('OK'); @@ -546,7 +546,7 @@ describe('ReactDOMConsoleErrorReporting', () => { } const root = ReactDOMClient.createRoot(container); - await act(async () => { + await act(() => { root.render( @@ -597,7 +597,7 @@ describe('ReactDOMConsoleErrorReporting', () => { // Check next render doesn't throw. windowOnError.mockReset(); console.error.mockReset(); - await act(async () => { + await act(() => { root.render(); }); expect(container.textContent).toBe('OK'); @@ -623,11 +623,11 @@ describe('ReactDOMConsoleErrorReporting', () => { ); } - await act(async () => { + await act(() => { ReactDOM.render(, container); }); - await act(async () => { + await act(() => { container.firstChild.dispatchEvent( new MouseEvent('click', { bubbles: true, @@ -698,7 +698,7 @@ describe('ReactDOMConsoleErrorReporting', () => { // Check next render doesn't throw. windowOnError.mockReset(); console.error.mockReset(); - await act(async () => { + await act(() => { ReactDOM.render(, container); }); expect(container.textContent).toBe('OK'); @@ -765,7 +765,7 @@ describe('ReactDOMConsoleErrorReporting', () => { // Check next render doesn't throw. windowOnError.mockReset(); console.error.mockReset(); - await act(async () => { + await act(() => { ReactDOM.render(, container); }); expect(container.textContent).toBe('OK'); @@ -784,7 +784,7 @@ describe('ReactDOMConsoleErrorReporting', () => { throw Error('Boom'); } - await act(async () => { + await act(() => { ReactDOM.render( @@ -837,7 +837,7 @@ describe('ReactDOMConsoleErrorReporting', () => { // Check next render doesn't throw. windowOnError.mockReset(); console.error.mockReset(); - await act(async () => { + await act(() => { ReactDOM.render(, container); }); expect(container.textContent).toBe('OK'); @@ -907,7 +907,7 @@ describe('ReactDOMConsoleErrorReporting', () => { // Check next render doesn't throw. windowOnError.mockReset(); console.error.mockReset(); - await act(async () => { + await act(() => { ReactDOM.render(, container); }); expect(container.textContent).toBe('OK'); @@ -929,7 +929,7 @@ describe('ReactDOMConsoleErrorReporting', () => { return null; } - await act(async () => { + await act(() => { ReactDOM.render( @@ -982,7 +982,7 @@ describe('ReactDOMConsoleErrorReporting', () => { // Check next render doesn't throw. windowOnError.mockReset(); console.error.mockReset(); - await act(async () => { + await act(() => { ReactDOM.render(, container); }); expect(container.textContent).toBe('OK'); @@ -1053,7 +1053,7 @@ describe('ReactDOMConsoleErrorReporting', () => { // Check next render doesn't throw. windowOnError.mockReset(); console.error.mockReset(); - await act(async () => { + await act(() => { ReactDOM.render(, container); }); expect(container.textContent).toBe('OK'); @@ -1075,7 +1075,7 @@ describe('ReactDOMConsoleErrorReporting', () => { return null; } - await act(async () => { + await act(() => { ReactDOM.render( @@ -1128,7 +1128,7 @@ describe('ReactDOMConsoleErrorReporting', () => { // Check next render doesn't throw. windowOnError.mockReset(); console.error.mockReset(); - await act(async () => { + await act(() => { ReactDOM.render(, container); }); expect(container.textContent).toBe('OK'); diff --git a/packages/react-dom/src/__tests__/ReactDOMFiberAsync-test.js b/packages/react-dom/src/__tests__/ReactDOMFiberAsync-test.js index f0e984de05d7d..79d70b4bf2437 100644 --- a/packages/react-dom/src/__tests__/ReactDOMFiberAsync-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMFiberAsync-test.js @@ -423,7 +423,7 @@ describe('ReactDOMFiberAsync', () => { } const root = ReactDOMClient.createRoot(container); - await act(async () => { + await act(() => { root.render(
); }); @@ -474,7 +474,7 @@ describe('ReactDOMFiberAsync', () => { } const root = ReactDOMClient.createRoot(container); - await act(async () => { + await act(() => { root.render(); }); @@ -484,7 +484,7 @@ describe('ReactDOMFiberAsync', () => { // Dispatch a click event on the Disable-button. const firstEvent = document.createEvent('Event'); firstEvent.initEvent('click', true, true); - await act(async () => { + await act(() => { disableButton.dispatchEvent(firstEvent); }); @@ -498,7 +498,7 @@ describe('ReactDOMFiberAsync', () => { const secondEvent = document.createEvent('Event'); secondEvent.initEvent('click', true, true); // This should force the pending update to flush which disables the submit button before the event is invoked. - await act(async () => { + await act(() => { submitButton.dispatchEvent(secondEvent); }); @@ -533,7 +533,7 @@ describe('ReactDOMFiberAsync', () => { } const root = ReactDOMClient.createRoot(container); - await act(async () => { + await act(() => { root.render(); }); @@ -543,7 +543,7 @@ describe('ReactDOMFiberAsync', () => { // Dispatch a click event on the Enable-button. const firstEvent = document.createEvent('Event'); firstEvent.initEvent('click', true, true); - await act(async () => { + await act(() => { enableButton.dispatchEvent(firstEvent); }); @@ -557,7 +557,7 @@ describe('ReactDOMFiberAsync', () => { const secondEvent = document.createEvent('Event'); secondEvent.initEvent('click', true, true); // This should force the pending update to flush which enables the submit button before the event is invoked. - await act(async () => { + await act(() => { submitButton.dispatchEvent(secondEvent); }); @@ -643,7 +643,7 @@ describe('ReactDOMFiberAsync', () => { } const oldRoot = ReactDOMClient.createRoot(container); - await act(async () => { + await act(() => { oldRoot.render(); }); diff --git a/packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js b/packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js index b95595a4c4cc4..766cdc66a3459 100644 --- a/packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js @@ -349,7 +349,7 @@ describe('ReactDOMFizzServer', () => { }; try { - await act(async () => { + await act(() => { const {pipe} = renderToPipeableStream(
@@ -373,7 +373,7 @@ describe('ReactDOMFizzServer', () => {
Loading...
, ); - await act(async () => { + await act(() => { resolveA({default: Text}); }); expect(getVisibleChildren(container)).toEqual( @@ -382,7 +382,7 @@ describe('ReactDOMFizzServer', () => {
Loading...
, ); - await act(async () => { + await act(() => { resolveB({default: TextWithPunctuation}); }); expect(getVisibleChildren(container)).toEqual( @@ -432,7 +432,7 @@ describe('ReactDOMFizzServer', () => { // Server-side const [App, resolve] = makeApp(); - await act(async () => { + await act(() => { const {pipe} = renderToPipeableStream(); pipe(writable); }); @@ -441,7 +441,7 @@ describe('ReactDOMFizzServer', () => { Loading... , ); - await act(async () => { + await act(() => { resolve(); }); expect(getVisibleChildren(container)).toEqual( @@ -453,7 +453,7 @@ describe('ReactDOMFizzServer', () => { // Client-side const [HydrateApp, hydrateResolve] = makeApp(); - await act(async () => { + await act(() => { ReactDOMClient.hydrateRoot(container, ); }); @@ -464,7 +464,7 @@ describe('ReactDOMFizzServer', () => { , ); - await act(async () => { + await act(() => { hydrateResolve(); }); expect(getVisibleChildren(container)).toEqual( @@ -485,7 +485,7 @@ describe('ReactDOMFizzServer', () => { }); }); - await act(async () => { + await act(() => { const {pipe} = renderToPipeableStream(
}> @@ -497,7 +497,7 @@ describe('ReactDOMFizzServer', () => { pipe(writable); }); expect(getVisibleChildren(container)).toEqual(
Loading...
); - await act(async () => { + await act(() => { resolve({default: Text}); }); expect(getVisibleChildren(container)).toEqual(
Hello
); @@ -545,7 +545,7 @@ describe('ReactDOMFizzServer', () => { const expectedDigest = onError(theError); loggedErrors.length = 0; - await act(async () => { + await act(() => { const {pipe} = renderToPipeableStream(, { bootstrapScriptContent: '__INIT__();', onError, @@ -562,7 +562,7 @@ describe('ReactDOMFizzServer', () => { expect(loggedErrors).toEqual([]); - await act(async () => { + await act(() => { rejectComponent(theError); }); @@ -604,7 +604,7 @@ describe('ReactDOMFizzServer', () => { }); }); - await act(async () => { + await act(() => { const {pipe} = renderToPipeableStream(
}> @@ -624,7 +624,7 @@ describe('ReactDOMFizzServer', () => { renderOptions.unstable_externalRuntimeSrc, ).length, ).toBe(1); - await act(async () => { + await act(() => { resolveElement({default: }); }); expect(getVisibleChildren(container)).toEqual(
Hello
); @@ -658,7 +658,7 @@ describe('ReactDOMFizzServer', () => { ); } - await act(async () => { + await act(() => { const {pipe} = renderToPipeableStream( , @@ -684,7 +684,7 @@ describe('ReactDOMFizzServer', () => { expect(loggedErrors).toEqual([]); - await act(async () => { + await act(() => { rejectElement(theError); }); @@ -754,7 +754,7 @@ describe('ReactDOMFizzServer', () => { const expectedDigest = onError(theError); loggedErrors.length = 0; - await act(async () => { + await act(() => { const {pipe} = renderToPipeableStream( , @@ -822,7 +822,7 @@ describe('ReactDOMFizzServer', () => { const expectedDigest = onError(theError); loggedErrors.length = 0; - await act(async () => { + await act(() => { const {pipe} = renderToPipeableStream( , @@ -845,7 +845,7 @@ describe('ReactDOMFizzServer', () => { expect(getVisibleChildren(container)).toEqual(
Loading...
); - await act(async () => { + await act(() => { rejectComponent(theError); }); @@ -878,7 +878,7 @@ describe('ReactDOMFizzServer', () => { }); it('should asynchronously load the suspense boundary', async () => { - await act(async () => { + await act(() => { const {pipe} = renderToPipeableStream(
}> @@ -889,7 +889,7 @@ describe('ReactDOMFizzServer', () => { pipe(writable); }); expect(getVisibleChildren(container)).toEqual(
Loading...
); - await act(async () => { + await act(() => { resolveText('Hello World'); }); expect(getVisibleChildren(container)).toEqual(
Hello World
); @@ -917,7 +917,7 @@ describe('ReactDOMFizzServer', () => { ReactDOMClient.hydrateRoot(container, ); }; - await act(async () => { + await act(() => { const {pipe} = renderToPipeableStream(, { bootstrapScriptContent: '__INIT__();', }); @@ -937,7 +937,7 @@ describe('ReactDOMFizzServer', () => { expect(getVisibleChildren(container)).toEqual(
Loading...
); // The server now updates the content in place in the fallback. - await act(async () => { + await act(() => { resolveText('Hello'); }); @@ -991,7 +991,7 @@ describe('ReactDOMFizzServer', () => { const loggedErrors = []; // We originally suspend the boundary and start streaming the loading state. - await act(async () => { + await act(() => { const {pipe} = renderToPipeableStream( , @@ -1017,7 +1017,7 @@ describe('ReactDOMFizzServer', () => { expect(getVisibleChildren(container)).toEqual(
Loading...
); const theError = new Error('Error Message'); - await act(async () => { + await act(() => { rejectText('This Errors', theError); }); @@ -1073,7 +1073,7 @@ describe('ReactDOMFizzServer', () => { } // We originally suspend the boundary and start streaming the loading state. - await act(async () => { + await act(() => { const {pipe} = renderToPipeableStream(); pipe(writable); }); @@ -1146,7 +1146,7 @@ describe('ReactDOMFizzServer', () => { } let controls; - await act(async () => { + await act(() => { controls = renderToPipeableStream(, {onError}); controls.pipe(writable); }); @@ -1166,7 +1166,7 @@ describe('ReactDOMFizzServer', () => { expect(getVisibleChildren(container)).toEqual(
Loading...
); // We abort the server response. - await act(async () => { + await act(() => { controls.abort(); }); @@ -1216,7 +1216,7 @@ describe('ReactDOMFizzServer', () => { writable.write(chunk, encoding, next); }; - await act(async () => { + await act(() => { const {pipe} = renderToPipeableStream( // We use two nested boundaries to flush out coverage of an old reentrancy bug. @@ -1240,7 +1240,7 @@ describe('ReactDOMFizzServer', () => { ); }); - await act(async () => { + await act(() => { const {pipe} = renderToPipeableStream( }> @@ -1264,7 +1264,7 @@ describe('ReactDOMFizzServer', () => {
Loading B...
, ]); - await act(async () => { + await act(() => { resolveText('B'); }); @@ -1275,7 +1275,7 @@ describe('ReactDOMFizzServer', () => {
, ]); - await act(async () => { + await act(() => { resolveText('A'); }); @@ -1336,7 +1336,7 @@ describe('ReactDOMFizzServer', () => { ); } - await act(async () => { + await act(() => { const {pipe} = renderToPipeableStream(); pipe(writable); }); @@ -1347,15 +1347,15 @@ describe('ReactDOMFizzServer', () => {
, ); - await act(async () => { + await act(() => { resolveText('Hello'); }); - await act(async () => { + await act(() => { resolveText('World'); }); - await act(async () => { + await act(() => { resolveText('my-path'); resolveText('my-mi'); }); @@ -1423,7 +1423,7 @@ describe('ReactDOMFizzServer', () => { ); } - await act(async () => { + await act(() => { const {pipe} = renderToPipeableStream(); pipe(writable); }); @@ -1438,15 +1438,15 @@ describe('ReactDOMFizzServer', () => { , ); - await act(async () => { + await act(() => { resolveText('A'); }); - await act(async () => { + await act(() => { resolveText('B'); }); - await act(async () => { + await act(() => { resolveText('C'); }); @@ -1476,7 +1476,7 @@ describe('ReactDOMFizzServer', () => { ); } - await act(async () => { + await act(() => { const {pipe} = renderToPipeableStream( , @@ -1499,7 +1499,7 @@ describe('ReactDOMFizzServer', () => { , ); - await act(async () => { + await act(() => { resolveText('my-path'); }); @@ -1562,7 +1562,7 @@ describe('ReactDOMFizzServer', () => { }; try { - await act(async () => { + await act(() => { const {pipe} = renderToPipeableStream(); pipe(writable); }); @@ -1589,7 +1589,7 @@ describe('ReactDOMFizzServer', () => { expect(mockError).not.toHaveBeenCalled(); } - await act(async () => { + await act(() => { resolveText('Hello'); resolveText('World'); }); @@ -1660,7 +1660,7 @@ describe('ReactDOMFizzServer', () => { } } - await act(async () => { + await act(() => { const {pipe} = renderToPipeableStream(
@@ -1680,7 +1680,7 @@ describe('ReactDOMFizzServer', () => { Loading: A
, ); - await act(async () => { + await act(() => { resolveText('Hello: '); }); expect(getVisibleChildren(container)).toEqual( @@ -1717,7 +1717,7 @@ describe('ReactDOMFizzServer', () => { ); } - await act(async () => { + await act(() => { const {pipe} = renderToPipeableStream(
@@ -1741,7 +1741,7 @@ describe('ReactDOMFizzServer', () => { A0
Loading...
A0
, ); - await act(async () => { + await act(() => { resolveText('Child:'); }); expect(getVisibleChildren(container)).toEqual( @@ -1778,7 +1778,7 @@ describe('ReactDOMFizzServer', () => { } const loggedErrors = []; - await act(async () => { + await act(() => { const {pipe} = renderToPipeableStream(
@@ -1846,7 +1846,7 @@ describe('ReactDOMFizzServer', () => { loggedErrors.length = 0; let controls; - await act(async () => { + await act(() => { controls = renderToPipeableStream( , @@ -1874,7 +1874,7 @@ describe('ReactDOMFizzServer', () => { expect(loggedErrors).toEqual([]); // Error the content, but we don't have a fallback yet. - await act(async () => { + await act(() => { rejectText('Hello', theError); }); @@ -1885,7 +1885,7 @@ describe('ReactDOMFizzServer', () => { expect(getVisibleChildren(container)).toEqual('Loading root...'); // Unblock the loading state - await act(async () => { + await act(() => { resolveText('Loading...'); }); @@ -1929,7 +1929,7 @@ describe('ReactDOMFizzServer', () => { }); it('should be able to abort the fallback if the main content finishes first', async () => { - await act(async () => { + await act(() => { const {pipe} = renderToPipeableStream( }>
@@ -1950,7 +1950,7 @@ describe('ReactDOMFizzServer', () => { expect(getVisibleChildren(container)).toEqual('Loading Outer'); // We should have received a partial segment containing the a partial of the fallback. expect(container.innerHTML).toContain('Inner'); - await act(async () => { + await act(() => { resolveText('Hello'); }); // We should've been able to display the content without waiting for the rest of the fallback. @@ -2026,7 +2026,7 @@ describe('ReactDOMFizzServer', () => { await jest.runAllTimers(); - await act(async () => { + await act(() => { const {pipe} = renderToPipeableStream(); pipe(writable); }); @@ -2036,7 +2036,7 @@ describe('ReactDOMFizzServer', () => { expect(container.innerHTML).not.toContain('Avoided Fallback'); // resolve first suspense component with avoidThisFallback - await act(async () => { + await act(() => { promiseRes[0](); }); @@ -2050,7 +2050,7 @@ describe('ReactDOMFizzServer', () => { expect(container.innerHTML).not.toContain('Avoided Fallback2'); - await act(async () => { + await act(() => { promiseRes[1](); }); @@ -2136,7 +2136,7 @@ describe('ReactDOMFizzServer', () => { } const loggedErrors = []; - await act(async () => { + await act(() => { const {pipe} = renderToPipeableStream( @@ -2219,7 +2219,7 @@ describe('ReactDOMFizzServer', () => { ); } const loggedErrors = []; - await act(async () => { + await act(() => { const {pipe} = renderToPipeableStream( @@ -2306,7 +2306,7 @@ describe('ReactDOMFizzServer', () => { ); } - await act(async () => { + await act(() => { const {pipe} = renderToPipeableStream(); pipe(writable); }); @@ -2396,7 +2396,7 @@ describe('ReactDOMFizzServer', () => { ); } - await act(async () => { + await act(() => { const {pipe} = renderToPipeableStream(); pipe(writable); }); @@ -2486,7 +2486,7 @@ describe('ReactDOMFizzServer', () => { ); } - await act(async () => { + await act(() => { const {pipe} = renderToPipeableStream(); pipe(writable); }); @@ -2539,7 +2539,7 @@ describe('ReactDOMFizzServer', () => {
); } - await act(async () => { + await act(() => { const {pipe} = renderToPipeableStream(, { onError(error) { Scheduler.log('[s!] ' + error.message); @@ -2576,7 +2576,7 @@ describe('ReactDOMFizzServer', () => { expect(serverFallback).toBe(clientFallback); // When we're able to fully hydrate, we expect a clean client render. - await act(async () => { + await act(() => { resolveText('Yay!'); }); await waitForAll([ @@ -2624,7 +2624,7 @@ describe('ReactDOMFizzServer', () => {
); } - await act(async () => { + await act(() => { const {pipe} = renderToPipeableStream(, { onError(error) { Scheduler.log('[s!] ' + error.message); @@ -2670,7 +2670,7 @@ describe('ReactDOMFizzServer', () => { expect(clientFallback2).toBe(serverFallback); // When we're able to fully hydrate, we expect a clean client render. - await act(async () => { + await act(() => { resolveText('Yay!'); }); await waitForAll([ @@ -2722,7 +2722,7 @@ describe('ReactDOMFizzServer', () => { ); } - await act(async () => { + await act(() => { const {pipe} = renderToPipeableStream( , { @@ -2784,7 +2784,7 @@ describe('ReactDOMFizzServer', () => { expect(clientFallback2).not.toBe(clientFallback1); // Verify we can still do a clean content render after. - await act(async () => { + await act(() => { resolveText('Yay!'); }); await waitForAll(['Yay!']); @@ -2851,7 +2851,7 @@ describe('ReactDOMFizzServer', () => { ); } - await act(async () => { + await act(() => { const {pipe} = renderToPipeableStream(); pipe(writable); }); @@ -2883,7 +2883,7 @@ describe('ReactDOMFizzServer', () => {
, ); - await act(async () => { + await act(() => { resolveText('Yay!'); }); await waitForAll(['Yay!']); @@ -3001,7 +3001,7 @@ describe('ReactDOMFizzServer', () => { ); } - await act(async () => { + await act(() => { const {pipe} = renderToPipeableStream(); pipe(writable); }); @@ -3065,7 +3065,7 @@ describe('ReactDOMFizzServer', () => { return {context}; } - await act(async () => { + await act(() => { const {pipe} = renderToPipeableStream(); pipe(writable); }); @@ -3087,7 +3087,7 @@ describe('ReactDOMFizzServer', () => { {name: 'b', value: 'b'}, ]).map(item =>
  • {item.get('name')}
  • ); - await act(async () => { + await act(() => { const {pipe} = renderToPipeableStream(
      {mappedJSX}
    ); pipe(writable); }); @@ -3119,7 +3119,7 @@ describe('ReactDOMFizzServer', () => { let abort; const loggedErrors = []; - await act(async () => { + await act(() => { const {pipe, abort: abortImpl} = renderToPipeableStream(, { onError(error) { // In this test we contrive erroring with strings so we push the error whereas in most @@ -3202,7 +3202,7 @@ describe('ReactDOMFizzServer', () => { let abort; const loggedErrors = []; - await act(async () => { + await act(() => { const {pipe, abort: abortImpl} = renderToPipeableStream(, { onError(error) { loggedErrors.push(error.message); @@ -3264,7 +3264,7 @@ describe('ReactDOMFizzServer', () => { }); it('warns in dev if you access digest from errorInfo in onRecoverableError', async () => { - await act(async () => { + await act(() => { const {pipe} = renderToPipeableStream(
    @@ -3341,7 +3341,7 @@ describe('ReactDOMFizzServer', () => { )}`; } - await act(async () => { + await act(() => { const {pipe} = renderToPipeableStream(, { onError, }); @@ -3389,7 +3389,7 @@ describe('ReactDOMFizzServer', () => { )}`; } - await act(async () => { + await act(() => { const {pipe} = renderToPipeableStream(, { onError, }); @@ -3429,7 +3429,7 @@ describe('ReactDOMFizzServer', () => { const expectedDigest = onError(theError); loggedErrors.length = 0; - await act(async () => { + await act(() => { const {pipe} = renderToPipeableStream(, { onError, }); @@ -3529,7 +3529,7 @@ describe('ReactDOMFizzServer', () => { window.__test_outlet = ''; const stringWithScriptsInIt = 'prescription pre