From c656deefc11bf960cc53a9eb85d0fa5d2ec6505f Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Mon, 28 Apr 2025 10:32:58 -0700 Subject: [PATCH 1/2] Remove extraneous word from DEV warning --- .../src/__tests__/ReactCompositeComponentState-test.js | 2 +- .../__tests__/ReactDOMServerPartialHydration-test.internal.js | 2 +- packages/react-reconciler/src/ReactFiberWorkLoop.js | 2 +- packages/react-reconciler/src/__tests__/Activity-test.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/react-dom/src/__tests__/ReactCompositeComponentState-test.js b/packages/react-dom/src/__tests__/ReactCompositeComponentState-test.js index d0d1c36e514a9..5c80660849cc3 100644 --- a/packages/react-dom/src/__tests__/ReactCompositeComponentState-test.js +++ b/packages/react-dom/src/__tests__/ReactCompositeComponentState-test.js @@ -573,7 +573,7 @@ describe('ReactCompositeComponent-state', () => { assertConsoleErrorDev([ "Can't perform a React state update on a component that hasn't mounted yet. " + 'This indicates that you have a side-effect in your render function that ' + - 'asynchronously later calls tries to update the component. ' + + 'asynchronously later tries to update the component. ' + 'Move this work to useEffect instead.\n' + ' in B (at **)', ]); diff --git a/packages/react-dom/src/__tests__/ReactDOMServerPartialHydration-test.internal.js b/packages/react-dom/src/__tests__/ReactDOMServerPartialHydration-test.internal.js index b3da527d30f8c..23468f4164f59 100644 --- a/packages/react-dom/src/__tests__/ReactDOMServerPartialHydration-test.internal.js +++ b/packages/react-dom/src/__tests__/ReactDOMServerPartialHydration-test.internal.js @@ -1922,7 +1922,7 @@ describe('ReactDOMServerPartialHydration', () => { assertConsoleErrorDev([ "Can't perform a React state update on a component that hasn't mounted yet. " + 'This indicates that you have a side-effect in your render function that ' + - 'asynchronously later calls tries to update the component. Move this work to useEffect instead.\n' + + 'asynchronously later tries to update the component. Move this work to useEffect instead.\n' + ' in App (at **)', ]); diff --git a/packages/react-reconciler/src/ReactFiberWorkLoop.js b/packages/react-reconciler/src/ReactFiberWorkLoop.js index 3a998aee8d3ed..f6221299b9aba 100644 --- a/packages/react-reconciler/src/ReactFiberWorkLoop.js +++ b/packages/react-reconciler/src/ReactFiberWorkLoop.js @@ -4787,7 +4787,7 @@ export function warnAboutUpdateOnNotYetMountedFiberInDEV(fiber: Fiber) { console.error( "Can't perform a React state update on a component that hasn't mounted yet. " + 'This indicates that you have a side-effect in your render function that ' + - 'asynchronously later calls tries to update the component. Move this work to ' + + 'asynchronously later tries to update the component. Move this work to ' + 'useEffect instead.', ); }); diff --git a/packages/react-reconciler/src/__tests__/Activity-test.js b/packages/react-reconciler/src/__tests__/Activity-test.js index d514bb4e0b0f0..235fd3e5b2656 100644 --- a/packages/react-reconciler/src/__tests__/Activity-test.js +++ b/packages/react-reconciler/src/__tests__/Activity-test.js @@ -764,7 +764,7 @@ describe('Activity', () => { assertConsoleErrorDev([ "Can't perform a React state update on a component that hasn't mounted yet. " + 'This indicates that you have a side-effect in your render function that ' + - 'asynchronously later calls tries to update the component. ' + + 'asynchronously later tries to update the component. ' + 'Move this work to useEffect instead.\n' + ' in Child (at **)', ]); From 29f3a8eca1dc417b75a78538a4ed6c4fde678971 Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Mon, 28 Apr 2025 10:46:05 -0700 Subject: [PATCH 2/2] Add test assertion I missed --- .../ReactDOMServerPartialHydrationActivity-test.internal.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-dom/src/__tests__/ReactDOMServerPartialHydrationActivity-test.internal.js b/packages/react-dom/src/__tests__/ReactDOMServerPartialHydrationActivity-test.internal.js index 1c82bb660d1c1..b11431ab35c83 100644 --- a/packages/react-dom/src/__tests__/ReactDOMServerPartialHydrationActivity-test.internal.js +++ b/packages/react-dom/src/__tests__/ReactDOMServerPartialHydrationActivity-test.internal.js @@ -1883,7 +1883,7 @@ describe('ReactDOMServerPartialHydrationActivity', () => { assertConsoleErrorDev([ "Can't perform a React state update on a component that hasn't mounted yet. " + 'This indicates that you have a side-effect in your render function that ' + - 'asynchronously later calls tries to update the component. Move this work to useEffect instead.\n' + + 'asynchronously later tries to update the component. Move this work to useEffect instead.\n' + ' in App (at **)', ]);