Skip to content

Commit

Permalink
Temporarily disable suspending during work loop (#30762)
Browse files Browse the repository at this point in the history
### Based on

- #30761
- #30759

---

`use` has an optimization where in some cases it can suspend the work
loop during the render phase until the data has resolved, rather than
unwind the stack and lose context. However, the current implementation
is not compatible with sibling prerendering. So I've temporarily
disabled it until the sibling prerendering has been refactored. We will
add it back in a later step.

DiffTrain build for commit 8b4c54c.
  • Loading branch information
acdlite committed Sep 4, 2024
1 parent 18e907e commit 9625df2
Show file tree
Hide file tree
Showing 14 changed files with 200 additions and 146 deletions.
2 changes: 1 addition & 1 deletion compiled-rn/VERSION_NATIVE_FB
Original file line number Diff line number Diff line change
@@ -1 +1 @@
19.0.0-native-fb-8d68da3f-20240903
19.0.0-native-fb-8b4c54c0-20240904
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<f2db4f138a96e7535db3c704161f2a6d>>
* @generated SignedSource<<c6f7f903e1bec097563ebf3f278e6601>>
*/

"use strict";
Expand Down Expand Up @@ -14952,11 +14952,11 @@ __DEV__ &&
(function () {
var internals = {
bundleType: 1,
version: "19.0.0-native-fb-8d68da3f-20240903",
version: "19.0.0-native-fb-8b4c54c0-20240904",
rendererPackageName: "react-test-renderer",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getInstanceFromNode,
reconcilerVersion: "19.0.0-native-fb-8d68da3f-20240903"
reconcilerVersion: "19.0.0-native-fb-8b4c54c0-20240904"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
Expand Down Expand Up @@ -15101,5 +15101,5 @@ __DEV__ &&
flushSyncWorkAcrossRoots_impl(0, !0));
}
};
exports.version = "19.0.0-native-fb-8d68da3f-20240903";
exports.version = "19.0.0-native-fb-8b4c54c0-20240904";
})();
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<8ab9ee6b60c4927fc87658452c1ef8e1>>
* @generated SignedSource<<5a26af5c141fa622359ef85bc2c68b89>>
*/

"use strict";
Expand Down Expand Up @@ -9331,14 +9331,14 @@ function wrapFiber(fiber) {
}
var internals$jscomp$inline_1216 = {
bundleType: 0,
version: "19.0.0-native-fb-8d68da3f-20240903",
version: "19.0.0-native-fb-8b4c54c0-20240904",
rendererPackageName: "react-test-renderer",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: function (mockNode) {
mockNode = nodeToInstanceMap.get(mockNode);
return void 0 !== mockNode ? mockNode.internalInstanceHandle : null;
},
reconcilerVersion: "19.0.0-native-fb-8d68da3f-20240903"
reconcilerVersion: "19.0.0-native-fb-8b4c54c0-20240904"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1217 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -9474,4 +9474,4 @@ exports.unstable_batchedUpdates = function (fn, a) {
flushSyncWorkAcrossRoots_impl(0, !0));
}
};
exports.version = "19.0.0-native-fb-8d68da3f-20240903";
exports.version = "19.0.0-native-fb-8b4c54c0-20240904";
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<e248d99b7723de8d3af2a0d7fe19e52e>>
* @generated SignedSource<<c20203164dfc6e7aa025edf017706934>>
*/

"use strict";
Expand Down Expand Up @@ -9944,14 +9944,14 @@ function wrapFiber(fiber) {
}
var internals$jscomp$inline_1117 = {
bundleType: 0,
version: "19.0.0-native-fb-8d68da3f-20240903",
version: "19.0.0-native-fb-8b4c54c0-20240904",
rendererPackageName: "react-test-renderer",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: function (mockNode) {
mockNode = nodeToInstanceMap.get(mockNode);
return void 0 !== mockNode ? mockNode.internalInstanceHandle : null;
},
reconcilerVersion: "19.0.0-native-fb-8d68da3f-20240903",
reconcilerVersion: "19.0.0-native-fb-8b4c54c0-20240904",
getLaneLabelMap: function () {
for (
var map = new Map(), lane = 1, index$149 = 0;
Expand Down Expand Up @@ -10102,4 +10102,4 @@ exports.unstable_batchedUpdates = function (fn, a) {
flushSyncWorkAcrossRoots_impl(0, !0));
}
};
exports.version = "19.0.0-native-fb-8d68da3f-20240903";
exports.version = "19.0.0-native-fb-8b4c54c0-20240904";
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<3086926418188819cb264b2b4ce337d7>>
* @generated SignedSource<<4bc17d91159f88d36be6292ac9f41c27>>
*/

"use strict";
Expand Down Expand Up @@ -1705,7 +1705,7 @@ __DEV__ &&
exports.useTransition = function () {
return resolveDispatcher().useTransition();
};
exports.version = "19.0.0-native-fb-8d68da3f-20240903";
exports.version = "19.0.0-native-fb-8b4c54c0-20240904";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<67e2739cc6ec149e186940fa71fedf5a>>
* @generated SignedSource<<a947a2762ffa8d0b953a4fcfef3f5aff>>
*/

"use strict";
Expand Down Expand Up @@ -580,4 +580,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-native-fb-8d68da3f-20240903";
exports.version = "19.0.0-native-fb-8b4c54c0-20240904";
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<00f72c0d892fa33507b893f4a9760683>>
* @generated SignedSource<<9bfd88b7f82babb5be244621de600336>>
*/

"use strict";
Expand Down Expand Up @@ -584,7 +584,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-native-fb-8d68da3f-20240903";
exports.version = "19.0.0-native-fb-8b4c54c0-20240904";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8d68da3f7396064614f34b84881fe8833b6039ac
8b4c54c00f5c047a72a4cecc2689196786c3e5ff
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<9ef28de841583eb0dc8a86a45dee3b60>>
* @generated SignedSource<<c45c09b72c4bf573045f0f9ed76c8735>>
*/

"use strict";
Expand Down Expand Up @@ -12135,20 +12135,28 @@ __DEV__ &&
current = null;
if (thrownValue === SuspenseException) {
thrownValue = getSuspendedThenable();
var handler = suspenseHandlerStackCursor.current;
var JSCompiler_temp;
if ((JSCompiler_temp = !enableSiblingPrerendering))
(JSCompiler_temp = suspenseHandlerStackCursor.current),
(JSCompiler_temp =
null === JSCompiler_temp
? !0
: (workInProgressRootRenderLanes & 4194176) ===
workInProgressRootRenderLanes
? null === shellBoundary
? !0
: !1
: (workInProgressRootRenderLanes & 62914560) ===
workInProgressRootRenderLanes ||
0 !== (workInProgressRootRenderLanes & 536870912)
? JSCompiler_temp === shellBoundary
: !1);
workInProgressSuspendedReason =
(null !== handler &&
((workInProgressRootRenderLanes & 4194176) ===
workInProgressRootRenderLanes
? null !== shellBoundary
: ((workInProgressRootRenderLanes & 62914560) !==
workInProgressRootRenderLanes &&
0 === (workInProgressRootRenderLanes & 536870912)) ||
handler !== shellBoundary)) ||
0 !== (workInProgressRootSkippedLanes & 134217727) ||
0 !== (workInProgressRootInterleavedUpdatedLanes & 134217727)
? SuspendedOnImmediate
: SuspendedOnData;
JSCompiler_temp &&
0 === (workInProgressRootSkippedLanes & 134217727) &&
0 === (workInProgressRootInterleavedUpdatedLanes & 134217727)
? SuspendedOnData
: SuspendedOnImmediate;
} else
thrownValue === SuspenseyCommitException
? ((thrownValue = getSuspendedThenable()),
Expand All @@ -12162,17 +12170,17 @@ __DEV__ &&
? SuspendedOnDeprecatedThrowPromise
: SuspendedOnError);
workInProgressThrownValue = thrownValue;
handler = workInProgress;
if (null === handler)
JSCompiler_temp = workInProgress;
if (null === JSCompiler_temp)
(workInProgressRootExitStatus = RootFatalErrored),
logUncaughtError(
root,
createCapturedValueAtFiber(thrownValue, root.current)
);
else
switch (
(handler.mode & 2 &&
stopProfilerTimerIfRunningAndRecordDelta(handler, !0),
(JSCompiler_temp.mode & 2 &&
stopProfilerTimerIfRunningAndRecordDelta(JSCompiler_temp, !0),
markComponentRenderStopped(),
workInProgressSuspendedReason)
) {
Expand All @@ -12181,7 +12189,7 @@ __DEV__ &&
"function" ===
typeof injectedProfilingHooks.markComponentErrored &&
injectedProfilingHooks.markComponentErrored(
handler,
JSCompiler_temp,
thrownValue,
workInProgressRootRenderLanes
);
Expand All @@ -12194,7 +12202,7 @@ __DEV__ &&
"function" ===
typeof injectedProfilingHooks.markComponentSuspended &&
injectedProfilingHooks.markComponentSuspended(
handler,
JSCompiler_temp,
thrownValue,
workInProgressRootRenderLanes
);
Expand Down Expand Up @@ -14239,6 +14247,7 @@ __DEV__ &&
dynamicFlagsUntyped.passChildrenWhenCloningPersistedNodes,
enableLazyContextPropagation =
dynamicFlagsUntyped.enableLazyContextPropagation,
enableSiblingPrerendering = dynamicFlagsUntyped.enableSiblingPrerendering,
REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"),
REACT_ELEMENT_TYPE = REACT_LEGACY_ELEMENT_TYPE,
REACT_PORTAL_TYPE = Symbol.for("react.portal"),
Expand Down Expand Up @@ -16966,11 +16975,11 @@ __DEV__ &&
(function () {
var internals = {
bundleType: 1,
version: "19.0.0-native-fb-8d68da3f-20240903",
version: "19.0.0-native-fb-8b4c54c0-20240904",
rendererPackageName: "react-native-renderer",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getInstanceFromNode,
reconcilerVersion: "19.0.0-native-fb-8d68da3f-20240903"
reconcilerVersion: "19.0.0-native-fb-8b4c54c0-20240904"
};
null !== extraDevToolsConfig &&
(internals.rendererConfig = extraDevToolsConfig);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<acaa31fb9763a1810659aacab7dd2a6f>>
* @generated SignedSource<<701a1703314df38ee706d756e6e3248d>>
*/

"use strict";
Expand All @@ -29,6 +29,7 @@ var ReactNativePrivateInterface = require("react-native/Libraries/ReactPrivate/R
dynamicFlagsUntyped.passChildrenWhenCloningPersistedNodes,
enableLazyContextPropagation =
dynamicFlagsUntyped.enableLazyContextPropagation,
enableSiblingPrerendering = dynamicFlagsUntyped.enableSiblingPrerendering,
ReactSharedInternals =
React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"),
Expand Down Expand Up @@ -9494,20 +9495,28 @@ function handleThrow(root, thrownValue) {
ReactSharedInternals.H = ContextOnlyDispatcher;
if (thrownValue === SuspenseException) {
thrownValue = getSuspendedThenable();
var handler = suspenseHandlerStackCursor.current;
var JSCompiler_temp;
if ((JSCompiler_temp = !enableSiblingPrerendering))
(JSCompiler_temp = suspenseHandlerStackCursor.current),
(JSCompiler_temp =
null === JSCompiler_temp
? !0
: (workInProgressRootRenderLanes & 4194176) ===
workInProgressRootRenderLanes
? null === shellBoundary
? !0
: !1
: (workInProgressRootRenderLanes & 62914560) ===
workInProgressRootRenderLanes ||
0 !== (workInProgressRootRenderLanes & 536870912)
? JSCompiler_temp === shellBoundary
: !1);
workInProgressSuspendedReason =
(null !== handler &&
((workInProgressRootRenderLanes & 4194176) ===
workInProgressRootRenderLanes
? null !== shellBoundary
: ((workInProgressRootRenderLanes & 62914560) !==
workInProgressRootRenderLanes &&
0 === (workInProgressRootRenderLanes & 536870912)) ||
handler !== shellBoundary)) ||
0 !== (workInProgressRootSkippedLanes & 134217727) ||
0 !== (workInProgressRootInterleavedUpdatedLanes & 134217727)
? 3
: 2;
JSCompiler_temp &&
0 === (workInProgressRootSkippedLanes & 134217727) &&
0 === (workInProgressRootInterleavedUpdatedLanes & 134217727)
? 2
: 3;
} else
thrownValue === SuspenseyCommitException
? ((thrownValue = getSuspendedThenable()),
Expand Down Expand Up @@ -10852,11 +10861,11 @@ batchedUpdatesImpl = function (fn, a) {
var roots = new Map(),
internals$jscomp$inline_1151 = {
bundleType: 0,
version: "19.0.0-native-fb-8d68da3f-20240903",
version: "19.0.0-native-fb-8b4c54c0-20240904",
rendererPackageName: "react-native-renderer",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getInstanceFromNode,
reconcilerVersion: "19.0.0-native-fb-8d68da3f-20240903"
reconcilerVersion: "19.0.0-native-fb-8b4c54c0-20240904"
};
null !== extraDevToolsConfig &&
(internals$jscomp$inline_1151.rendererConfig = extraDevToolsConfig);
Expand Down
Loading

0 comments on commit 9625df2

Please sign in to comment.