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
Warn if optimistic state is updated outside of a transition (#27454)
### Based on #27453
If optimistic state is updated, and there's no startTransition on the
stack, there are two likely scenarios.
One possibility is that the optimistic update is triggered by a regular
event handler (e.g. `onSubmit`) instead of an action. This is a mistake
and we will warn.
The other possibility is the optimistic update is inside an async
action, but after an `await`. In this case, we can make it "just work"
by associating the optimistic update with the pending async action.
Technically it's possible that the optimistic update is unrelated to the
pending action, but we don't have a way of knowing this for sure because
browsers currently do not provide a way to track async scope. (The
AsyncContext proposal, if it lands, will solve this in the future.)
However, this is no different than the problem of unrelated transitions
being grouped together — it's not wrong per se, but it's not ideal.
Once AsyncContext starts landing in browsers, we will provide better
warnings in development for these cases.
DiffTrain build for commit 88d56b8.
Copy file name to clipboardExpand all lines: compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js
Copy file name to clipboardExpand all lines: compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -8623,7 +8623,7 @@ var devToolsConfig$jscomp$inline_1030 = {
8623
8623
throwError("TestRenderer does not support findFiberByHostInstance()");
8624
8624
},
8625
8625
bundleType: 0,
8626
-
version: "18.3.0-canary-bd6891742-20231004",
8626
+
version: "18.3.0-canary-88d56b8e8-20231004",
8627
8627
rendererPackageName: "react-test-renderer"
8628
8628
};
8629
8629
varinternals$jscomp$inline_1229={
@@ -8654,7 +8654,7 @@ var internals$jscomp$inline_1229 = {
Copy file name to clipboardExpand all lines: compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -9049,7 +9049,7 @@ var devToolsConfig$jscomp$inline_1072 = {
9049
9049
throwError("TestRenderer does not support findFiberByHostInstance()");
9050
9050
},
9051
9051
bundleType: 0,
9052
-
version: "18.3.0-canary-bd6891742-20231004",
9052
+
version: "18.3.0-canary-88d56b8e8-20231004",
9053
9053
rendererPackageName: "react-test-renderer"
9054
9054
};
9055
9055
varinternals$jscomp$inline_1270={
@@ -9080,7 +9080,7 @@ var internals$jscomp$inline_1270 = {
Copy file name to clipboardExpand all lines: compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js
Copy file name to clipboardExpand all lines: compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js
0 commit comments