From 12d760c9396a617f4d0e5ff797c4e0fbfaa79c0c Mon Sep 17 00:00:00 2001 From: acdlite Date: Thu, 20 Apr 2023 18:28:14 +0000 Subject: [PATCH] Add `alwaysThrottleRetries` flag (#26685) This puts the change introduced by #26611 behind a flag until Meta is able to roll it out. Disabling the flag reverts back to the old behavior, where retries are throttled if there's still data remaining in the tree, but not if all the data has finished loading. The new behavior is still enabled in the public builds. DiffTrain build for commit https://github.com/facebook/react/commit/d73d7d59086218b0fa42d0a79c32a0365952650b. --- .../cjs/ReactTestRenderer-dev.js | 9 +-- .../cjs/ReactTestRenderer-prod.js | 4 +- .../cjs/ReactTestRenderer-profiling.js | 4 +- .../RKJSModules/vendor/react/cjs/React-dev.js | 2 +- .../vendor/react/cjs/React-prod.js | 2 +- .../vendor/react/cjs/React-profiling.js | 2 +- .../Libraries/Renderer/REVISION | 2 +- .../implementations/ReactFabric-dev.fb.js | 12 ++-- .../implementations/ReactFabric-prod.fb.js | 58 ++++++++++--------- .../ReactFabric-profiling.fb.js | 58 ++++++++++--------- .../ReactNativeRenderer-dev.fb.js | 12 ++-- .../ReactNativeRenderer-prod.fb.js | 58 ++++++++++--------- .../ReactNativeRenderer-profiling.fb.js | 58 ++++++++++--------- 13 files changed, 149 insertions(+), 132 deletions(-) diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js index 0b4b3ec87d..08d25cf919 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<43355784ad4a055ab0a02e5c5e648c88>> */ 'use strict'; @@ -145,7 +145,8 @@ var createRootStrictEffectsByDefault = false; var enableLazyContextPropagation = false; var enableLegacyHidden = false; var diffInCommitPhase = true; -var enableAsyncActions = false; // Flow magic to verify the exports of this file match the original version. +var enableAsyncActions = false; +var alwaysThrottleRetries = true; // Flow magic to verify the exports of this file match the original version. var FunctionComponent = 0; var ClassComponent = 1; @@ -20431,7 +20432,7 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { workInProgressTransitions ); } else { - if (includesOnlyRetries(lanes)) { + if (includesOnlyRetries(lanes) && alwaysThrottleRetries) { // This render only included retries, no updates. Throttle committing // retries so that we don't show too many loading states too quickly. var msUntilTimeout = @@ -23858,7 +23859,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-next-7f8c501f6-20230420"; +var ReactVersion = "18.3.0-next-d73d7d590-20230420"; // Might add PROFILE later. diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js index 61f5ff7354..f9e7ff1887 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js @@ -8599,7 +8599,7 @@ var devToolsConfig$jscomp$inline_1021 = { throw Error("TestRenderer does not support findFiberByHostInstance()"); }, bundleType: 0, - version: "18.3.0-next-7f8c501f6-20230420", + version: "18.3.0-next-d73d7d590-20230420", rendererPackageName: "react-test-renderer" }; var internals$jscomp$inline_1206 = { @@ -8630,7 +8630,7 @@ var internals$jscomp$inline_1206 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-7f8c501f6-20230420" + reconcilerVersion: "18.3.0-next-d73d7d590-20230420" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_1207 = __REACT_DEVTOOLS_GLOBAL_HOOK__; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js index df3d391f5c..e2a81e13d7 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js @@ -9025,7 +9025,7 @@ var devToolsConfig$jscomp$inline_1063 = { throw Error("TestRenderer does not support findFiberByHostInstance()"); }, bundleType: 0, - version: "18.3.0-next-7f8c501f6-20230420", + version: "18.3.0-next-d73d7d590-20230420", rendererPackageName: "react-test-renderer" }; var internals$jscomp$inline_1247 = { @@ -9056,7 +9056,7 @@ var internals$jscomp$inline_1247 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-7f8c501f6-20230420" + reconcilerVersion: "18.3.0-next-d73d7d590-20230420" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_1248 = __REACT_DEVTOOLS_GLOBAL_HOOK__; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js index fedcacb522..cb002eb630 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js @@ -27,7 +27,7 @@ if ( } "use strict"; -var ReactVersion = "18.3.0-next-7f8c501f6-20230420"; +var ReactVersion = "18.3.0-next-d73d7d590-20230420"; // ATTENTION // When adding new symbols to this file, diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js index 89748ac6da..d6b9054dc7 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js @@ -639,4 +639,4 @@ exports.useSyncExternalStore = function ( ); }; exports.useTransition = useTransition; -exports.version = "18.3.0-next-7f8c501f6-20230420"; +exports.version = "18.3.0-next-d73d7d590-20230420"; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js index 336ddc8071..a8163f554d 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js @@ -642,7 +642,7 @@ exports.useSyncExternalStore = function ( ); }; exports.useTransition = useTransition; -exports.version = "18.3.0-next-7f8c501f6-20230420"; +exports.version = "18.3.0-next-d73d7d590-20230420"; /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ if ( diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION index 23078af5af..4a9300f564 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION @@ -1 +1 @@ -7f8c501f682bd4abe24826a93538059d717ba39e +d73d7d59086218b0fa42d0a79c32a0365952650b diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js index e72aefc08c..ac245d7c0c 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<13be0ed73b0dd62cc37d1e24af8fe51a>> + * @generated SignedSource<<78a825a4d424f226b6f344ef3a16b2ec>> */ 'use strict'; @@ -3198,7 +3198,8 @@ function dispatchEvent(target, topLevelType, nativeEvent) { var enableUseRefAccessWarning = dynamicFlags.enableUseRefAccessWarning, enableDeferRootSchedulingToMicrotask = - dynamicFlags.enableDeferRootSchedulingToMicrotask; // The rest of the flags are static for better dead code elimination. + dynamicFlags.enableDeferRootSchedulingToMicrotask, + alwaysThrottleRetries = dynamicFlags.alwaysThrottleRetries; // The rest of the flags are static for better dead code elimination. var enableSchedulingProfiler = true; var enableProfilerTimer = true; var enableProfilerCommitHooks = true; @@ -23536,7 +23537,10 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { workInProgressTransitions ); } else { - if (includesOnlyRetries(lanes)) { + if ( + includesOnlyRetries(lanes) && + (alwaysThrottleRetries || exitStatus === RootSuspended) + ) { // This render only included retries, no updates. Throttle committing // retries so that we don't show too many loading states too quickly. var msUntilTimeout = @@ -27165,7 +27169,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-next-7f8c501f6-20230420"; +var ReactVersion = "18.3.0-next-d73d7d590-20230420"; function createPortal$1( children, diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-prod.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-prod.fb.js index 2583142b18..391e8ce521 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-prod.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-prod.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<0b0bda830df48380bcde0d6ac5c73756>> + * @generated SignedSource<<472cb7f28d742af2e290a0816a880f33>> */ "use strict"; @@ -1317,6 +1317,7 @@ function dispatchEvent(target, topLevelType, nativeEvent) { var enableUseRefAccessWarning = dynamicFlags.enableUseRefAccessWarning, enableDeferRootSchedulingToMicrotask = dynamicFlags.enableDeferRootSchedulingToMicrotask, + alwaysThrottleRetries = dynamicFlags.alwaysThrottleRetries, scheduleCallback$2 = Scheduler.unstable_scheduleCallback, cancelCallback$1 = Scheduler.unstable_cancelCallback, shouldYield = Scheduler.unstable_shouldYield, @@ -7567,28 +7568,28 @@ function performConcurrentWorkOnRoot(root, didTimeout) { root === workInProgressRoot ? workInProgressRootRenderLanes : 0 ); if (0 === lanes) return null; - didTimeout = + var exitStatus = includesBlockingLane(root, lanes) || 0 !== (lanes & root.expiredLanes) || didTimeout ? renderRootSync(root, lanes) : renderRootConcurrent(root, lanes); - if (0 !== didTimeout) { - if (2 === didTimeout) { - var originallyAttemptedLanes = lanes, - errorRetryLanes = getLanesToRetrySynchronouslyOnError( - root, - originallyAttemptedLanes - ); + if (0 !== exitStatus) { + if (2 === exitStatus) { + didTimeout = lanes; + var errorRetryLanes = getLanesToRetrySynchronouslyOnError( + root, + didTimeout + ); 0 !== errorRetryLanes && ((lanes = errorRetryLanes), - (didTimeout = recoverFromConcurrentError( + (exitStatus = recoverFromConcurrentError( root, - originallyAttemptedLanes, + didTimeout, errorRetryLanes ))); } - if (1 === didTimeout) + if (1 === exitStatus) throw ( ((originalCallbackNode = workInProgressRootFatalError), prepareFreshStack(root, 0), @@ -7596,16 +7597,16 @@ function performConcurrentWorkOnRoot(root, didTimeout) { ensureRootIsScheduled(root), originalCallbackNode) ); - if (6 === didTimeout) markRootSuspended(root, lanes); + if (6 === exitStatus) markRootSuspended(root, lanes); else { errorRetryLanes = !includesBlockingLane(root, lanes); - originallyAttemptedLanes = root.current.alternate; + didTimeout = root.current.alternate; if ( errorRetryLanes && - !isRenderConsistentWithExternalStores(originallyAttemptedLanes) + !isRenderConsistentWithExternalStores(didTimeout) ) { - didTimeout = renderRootSync(root, lanes); - if (2 === didTimeout) { + exitStatus = renderRootSync(root, lanes); + if (2 === exitStatus) { errorRetryLanes = lanes; var errorRetryLanes$96 = getLanesToRetrySynchronouslyOnError( root, @@ -7613,13 +7614,13 @@ function performConcurrentWorkOnRoot(root, didTimeout) { ); 0 !== errorRetryLanes$96 && ((lanes = errorRetryLanes$96), - (didTimeout = recoverFromConcurrentError( + (exitStatus = recoverFromConcurrentError( root, errorRetryLanes, errorRetryLanes$96 ))); } - if (1 === didTimeout) + if (1 === exitStatus) throw ( ((originalCallbackNode = workInProgressRootFatalError), prepareFreshStack(root, 0), @@ -7628,10 +7629,10 @@ function performConcurrentWorkOnRoot(root, didTimeout) { originalCallbackNode) ); } - root.finishedWork = originallyAttemptedLanes; + root.finishedWork = didTimeout; root.finishedLanes = lanes; a: { - switch (didTimeout) { + switch (exitStatus) { case 0: case 1: throw Error("Root did not complete. This is a bug in React."); @@ -7650,8 +7651,9 @@ function performConcurrentWorkOnRoot(root, didTimeout) { } if ( (lanes & 125829120) === lanes && - ((didTimeout = globalMostRecentFallbackTime + 500 - now()), - 10 < didTimeout) + (alwaysThrottleRetries || 3 === exitStatus) && + ((exitStatus = globalMostRecentFallbackTime + 500 - now()), + 10 < exitStatus) ) { markRootSuspended(root, lanes); if (0 !== getNextLanes(root, 0)) break a; @@ -7659,18 +7661,18 @@ function performConcurrentWorkOnRoot(root, didTimeout) { commitRootWhenReady.bind( null, root, - originallyAttemptedLanes, + didTimeout, workInProgressRootRecoverableErrors, workInProgressTransitions, lanes ), - didTimeout + exitStatus ); break a; } commitRootWhenReady( root, - originallyAttemptedLanes, + didTimeout, workInProgressRootRecoverableErrors, workInProgressTransitions, lanes @@ -9468,7 +9470,7 @@ var roots = new Map(), devToolsConfig$jscomp$inline_1045 = { findFiberByHostInstance: getInstanceFromNode, bundleType: 0, - version: "18.3.0-next-7f8c501f6-20230420", + version: "18.3.0-next-d73d7d590-20230420", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForViewTag: function () { @@ -9510,7 +9512,7 @@ var internals$jscomp$inline_1276 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-7f8c501f6-20230420" + reconcilerVersion: "18.3.0-next-d73d7d590-20230420" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_1277 = __REACT_DEVTOOLS_GLOBAL_HOOK__; diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js index 4d228df8a8..74f51d608c 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<62e5871fa2a1f61ba1d7d0e5e2ccb1ca>> + * @generated SignedSource<> */ @@ -1328,6 +1328,7 @@ function dispatchEvent(target, topLevelType, nativeEvent) { var enableUseRefAccessWarning = dynamicFlags.enableUseRefAccessWarning, enableDeferRootSchedulingToMicrotask = dynamicFlags.enableDeferRootSchedulingToMicrotask, + alwaysThrottleRetries = dynamicFlags.alwaysThrottleRetries, scheduleCallback$2 = Scheduler.unstable_scheduleCallback, cancelCallback$1 = Scheduler.unstable_cancelCallback, shouldYield = Scheduler.unstable_shouldYield, @@ -8098,28 +8099,28 @@ function performConcurrentWorkOnRoot(root, didTimeout) { root === workInProgressRoot ? workInProgressRootRenderLanes : 0 ); if (0 === lanes) return null; - didTimeout = + var exitStatus = includesBlockingLane(root, lanes) || 0 !== (lanes & root.expiredLanes) || didTimeout ? renderRootSync(root, lanes) : renderRootConcurrent(root, lanes); - if (0 !== didTimeout) { - if (2 === didTimeout) { - var originallyAttemptedLanes = lanes, - errorRetryLanes = getLanesToRetrySynchronouslyOnError( - root, - originallyAttemptedLanes - ); + if (0 !== exitStatus) { + if (2 === exitStatus) { + didTimeout = lanes; + var errorRetryLanes = getLanesToRetrySynchronouslyOnError( + root, + didTimeout + ); 0 !== errorRetryLanes && ((lanes = errorRetryLanes), - (didTimeout = recoverFromConcurrentError( + (exitStatus = recoverFromConcurrentError( root, - originallyAttemptedLanes, + didTimeout, errorRetryLanes ))); } - if (1 === didTimeout) + if (1 === exitStatus) throw ( ((originalCallbackNode = workInProgressRootFatalError), prepareFreshStack(root, 0), @@ -8127,16 +8128,16 @@ function performConcurrentWorkOnRoot(root, didTimeout) { ensureRootIsScheduled(root), originalCallbackNode) ); - if (6 === didTimeout) markRootSuspended(root, lanes); + if (6 === exitStatus) markRootSuspended(root, lanes); else { errorRetryLanes = !includesBlockingLane(root, lanes); - originallyAttemptedLanes = root.current.alternate; + didTimeout = root.current.alternate; if ( errorRetryLanes && - !isRenderConsistentWithExternalStores(originallyAttemptedLanes) + !isRenderConsistentWithExternalStores(didTimeout) ) { - didTimeout = renderRootSync(root, lanes); - if (2 === didTimeout) { + exitStatus = renderRootSync(root, lanes); + if (2 === exitStatus) { errorRetryLanes = lanes; var errorRetryLanes$112 = getLanesToRetrySynchronouslyOnError( root, @@ -8144,13 +8145,13 @@ function performConcurrentWorkOnRoot(root, didTimeout) { ); 0 !== errorRetryLanes$112 && ((lanes = errorRetryLanes$112), - (didTimeout = recoverFromConcurrentError( + (exitStatus = recoverFromConcurrentError( root, errorRetryLanes, errorRetryLanes$112 ))); } - if (1 === didTimeout) + if (1 === exitStatus) throw ( ((originalCallbackNode = workInProgressRootFatalError), prepareFreshStack(root, 0), @@ -8159,10 +8160,10 @@ function performConcurrentWorkOnRoot(root, didTimeout) { originalCallbackNode) ); } - root.finishedWork = originallyAttemptedLanes; + root.finishedWork = didTimeout; root.finishedLanes = lanes; a: { - switch (didTimeout) { + switch (exitStatus) { case 0: case 1: throw Error("Root did not complete. This is a bug in React."); @@ -8181,8 +8182,9 @@ function performConcurrentWorkOnRoot(root, didTimeout) { } if ( (lanes & 125829120) === lanes && - ((didTimeout = globalMostRecentFallbackTime + 500 - now$1()), - 10 < didTimeout) + (alwaysThrottleRetries || 3 === exitStatus) && + ((exitStatus = globalMostRecentFallbackTime + 500 - now$1()), + 10 < exitStatus) ) { markRootSuspended(root, lanes); if (0 !== getNextLanes(root, 0)) break a; @@ -8190,18 +8192,18 @@ function performConcurrentWorkOnRoot(root, didTimeout) { commitRootWhenReady.bind( null, root, - originallyAttemptedLanes, + didTimeout, workInProgressRootRecoverableErrors, workInProgressTransitions, lanes ), - didTimeout + exitStatus ); break a; } commitRootWhenReady( root, - originallyAttemptedLanes, + didTimeout, workInProgressRootRecoverableErrors, workInProgressTransitions, lanes @@ -10177,7 +10179,7 @@ var roots = new Map(), devToolsConfig$jscomp$inline_1123 = { findFiberByHostInstance: getInstanceFromNode, bundleType: 0, - version: "18.3.0-next-7f8c501f6-20230420", + version: "18.3.0-next-d73d7d590-20230420", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForViewTag: function () { @@ -10232,7 +10234,7 @@ var roots = new Map(), scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-7f8c501f6-20230420" + reconcilerVersion: "18.3.0-next-d73d7d590-20230420" }); exports.createPortal = function (children, containerTag) { return createPortal$1( diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js index 730fdf9c31..63a13ec306 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<> */ 'use strict'; @@ -2917,7 +2917,8 @@ function set(key, value) { var enableUseRefAccessWarning = dynamicFlags.enableUseRefAccessWarning, enableDeferRootSchedulingToMicrotask = - dynamicFlags.enableDeferRootSchedulingToMicrotask; // The rest of the flags are static for better dead code elimination. + dynamicFlags.enableDeferRootSchedulingToMicrotask, + alwaysThrottleRetries = dynamicFlags.alwaysThrottleRetries; // The rest of the flags are static for better dead code elimination. var enableSchedulingProfiler = true; var enableProfilerTimer = true; var enableProfilerCommitHooks = true; @@ -24049,7 +24050,10 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { workInProgressTransitions ); } else { - if (includesOnlyRetries(lanes)) { + if ( + includesOnlyRetries(lanes) && + (alwaysThrottleRetries || exitStatus === RootSuspended) + ) { // This render only included retries, no updates. Throttle committing // retries so that we don't show too many loading states too quickly. var msUntilTimeout = @@ -27678,7 +27682,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-next-7f8c501f6-20230420"; +var ReactVersion = "18.3.0-next-d73d7d590-20230420"; function createPortal$1( children, diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js index c71a12bdfb..aa5d044d6c 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<83f90ff98709415fa3ab035afd4a2821>> + * @generated SignedSource<<54d01cff9e9c78ffba08f73a6631a077>> */ "use strict"; @@ -1162,6 +1162,7 @@ var ReactSharedInternals = enableUseRefAccessWarning = dynamicFlags.enableUseRefAccessWarning, enableDeferRootSchedulingToMicrotask = dynamicFlags.enableDeferRootSchedulingToMicrotask, + alwaysThrottleRetries = dynamicFlags.alwaysThrottleRetries, REACT_ELEMENT_TYPE = Symbol.for("react.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), @@ -7819,28 +7820,28 @@ function performConcurrentWorkOnRoot(root, didTimeout) { root === workInProgressRoot ? workInProgressRootRenderLanes : 0 ); if (0 === lanes) return null; - didTimeout = + var exitStatus = includesBlockingLane(root, lanes) || 0 !== (lanes & root.expiredLanes) || didTimeout ? renderRootSync(root, lanes) : renderRootConcurrent(root, lanes); - if (0 !== didTimeout) { - if (2 === didTimeout) { - var originallyAttemptedLanes = lanes, - errorRetryLanes = getLanesToRetrySynchronouslyOnError( - root, - originallyAttemptedLanes - ); + if (0 !== exitStatus) { + if (2 === exitStatus) { + didTimeout = lanes; + var errorRetryLanes = getLanesToRetrySynchronouslyOnError( + root, + didTimeout + ); 0 !== errorRetryLanes && ((lanes = errorRetryLanes), - (didTimeout = recoverFromConcurrentError( + (exitStatus = recoverFromConcurrentError( root, - originallyAttemptedLanes, + didTimeout, errorRetryLanes ))); } - if (1 === didTimeout) + if (1 === exitStatus) throw ( ((originalCallbackNode = workInProgressRootFatalError), prepareFreshStack(root, 0), @@ -7848,16 +7849,16 @@ function performConcurrentWorkOnRoot(root, didTimeout) { ensureRootIsScheduled(root), originalCallbackNode) ); - if (6 === didTimeout) markRootSuspended(root, lanes); + if (6 === exitStatus) markRootSuspended(root, lanes); else { errorRetryLanes = !includesBlockingLane(root, lanes); - originallyAttemptedLanes = root.current.alternate; + didTimeout = root.current.alternate; if ( errorRetryLanes && - !isRenderConsistentWithExternalStores(originallyAttemptedLanes) + !isRenderConsistentWithExternalStores(didTimeout) ) { - didTimeout = renderRootSync(root, lanes); - if (2 === didTimeout) { + exitStatus = renderRootSync(root, lanes); + if (2 === exitStatus) { errorRetryLanes = lanes; var errorRetryLanes$102 = getLanesToRetrySynchronouslyOnError( root, @@ -7865,13 +7866,13 @@ function performConcurrentWorkOnRoot(root, didTimeout) { ); 0 !== errorRetryLanes$102 && ((lanes = errorRetryLanes$102), - (didTimeout = recoverFromConcurrentError( + (exitStatus = recoverFromConcurrentError( root, errorRetryLanes, errorRetryLanes$102 ))); } - if (1 === didTimeout) + if (1 === exitStatus) throw ( ((originalCallbackNode = workInProgressRootFatalError), prepareFreshStack(root, 0), @@ -7880,10 +7881,10 @@ function performConcurrentWorkOnRoot(root, didTimeout) { originalCallbackNode) ); } - root.finishedWork = originallyAttemptedLanes; + root.finishedWork = didTimeout; root.finishedLanes = lanes; a: { - switch (didTimeout) { + switch (exitStatus) { case 0: case 1: throw Error("Root did not complete. This is a bug in React."); @@ -7902,8 +7903,9 @@ function performConcurrentWorkOnRoot(root, didTimeout) { } if ( (lanes & 125829120) === lanes && - ((didTimeout = globalMostRecentFallbackTime + 500 - now()), - 10 < didTimeout) + (alwaysThrottleRetries || 3 === exitStatus) && + ((exitStatus = globalMostRecentFallbackTime + 500 - now()), + 10 < exitStatus) ) { markRootSuspended(root, lanes); if (0 !== getNextLanes(root, 0)) break a; @@ -7911,18 +7913,18 @@ function performConcurrentWorkOnRoot(root, didTimeout) { commitRootWhenReady.bind( null, root, - originallyAttemptedLanes, + didTimeout, workInProgressRootRecoverableErrors, workInProgressTransitions, lanes ), - didTimeout + exitStatus ); break a; } commitRootWhenReady( root, - originallyAttemptedLanes, + didTimeout, workInProgressRootRecoverableErrors, workInProgressTransitions, lanes @@ -9727,7 +9729,7 @@ var roots = new Map(), devToolsConfig$jscomp$inline_1100 = { findFiberByHostInstance: getInstanceFromTag, bundleType: 0, - version: "18.3.0-next-7f8c501f6-20230420", + version: "18.3.0-next-d73d7d590-20230420", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForViewTag: function () { @@ -9769,7 +9771,7 @@ var internals$jscomp$inline_1345 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-7f8c501f6-20230420" + reconcilerVersion: "18.3.0-next-d73d7d590-20230420" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_1346 = __REACT_DEVTOOLS_GLOBAL_HOOK__; diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js index 485630f4ee..08f09a3528 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<3b13a421b8eb84471cd505d2ab17ec9b>> + * @generated SignedSource<<1ac72a305be24eff51144b88fe9c565d>> */ @@ -1173,6 +1173,7 @@ var ReactSharedInternals = enableUseRefAccessWarning = dynamicFlags.enableUseRefAccessWarning, enableDeferRootSchedulingToMicrotask = dynamicFlags.enableDeferRootSchedulingToMicrotask, + alwaysThrottleRetries = dynamicFlags.alwaysThrottleRetries, REACT_ELEMENT_TYPE = Symbol.for("react.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), @@ -8350,28 +8351,28 @@ function performConcurrentWorkOnRoot(root, didTimeout) { root === workInProgressRoot ? workInProgressRootRenderLanes : 0 ); if (0 === lanes) return null; - didTimeout = + var exitStatus = includesBlockingLane(root, lanes) || 0 !== (lanes & root.expiredLanes) || didTimeout ? renderRootSync(root, lanes) : renderRootConcurrent(root, lanes); - if (0 !== didTimeout) { - if (2 === didTimeout) { - var originallyAttemptedLanes = lanes, - errorRetryLanes = getLanesToRetrySynchronouslyOnError( - root, - originallyAttemptedLanes - ); + if (0 !== exitStatus) { + if (2 === exitStatus) { + didTimeout = lanes; + var errorRetryLanes = getLanesToRetrySynchronouslyOnError( + root, + didTimeout + ); 0 !== errorRetryLanes && ((lanes = errorRetryLanes), - (didTimeout = recoverFromConcurrentError( + (exitStatus = recoverFromConcurrentError( root, - originallyAttemptedLanes, + didTimeout, errorRetryLanes ))); } - if (1 === didTimeout) + if (1 === exitStatus) throw ( ((originalCallbackNode = workInProgressRootFatalError), prepareFreshStack(root, 0), @@ -8379,16 +8380,16 @@ function performConcurrentWorkOnRoot(root, didTimeout) { ensureRootIsScheduled(root), originalCallbackNode) ); - if (6 === didTimeout) markRootSuspended(root, lanes); + if (6 === exitStatus) markRootSuspended(root, lanes); else { errorRetryLanes = !includesBlockingLane(root, lanes); - originallyAttemptedLanes = root.current.alternate; + didTimeout = root.current.alternate; if ( errorRetryLanes && - !isRenderConsistentWithExternalStores(originallyAttemptedLanes) + !isRenderConsistentWithExternalStores(didTimeout) ) { - didTimeout = renderRootSync(root, lanes); - if (2 === didTimeout) { + exitStatus = renderRootSync(root, lanes); + if (2 === exitStatus) { errorRetryLanes = lanes; var errorRetryLanes$118 = getLanesToRetrySynchronouslyOnError( root, @@ -8396,13 +8397,13 @@ function performConcurrentWorkOnRoot(root, didTimeout) { ); 0 !== errorRetryLanes$118 && ((lanes = errorRetryLanes$118), - (didTimeout = recoverFromConcurrentError( + (exitStatus = recoverFromConcurrentError( root, errorRetryLanes, errorRetryLanes$118 ))); } - if (1 === didTimeout) + if (1 === exitStatus) throw ( ((originalCallbackNode = workInProgressRootFatalError), prepareFreshStack(root, 0), @@ -8411,10 +8412,10 @@ function performConcurrentWorkOnRoot(root, didTimeout) { originalCallbackNode) ); } - root.finishedWork = originallyAttemptedLanes; + root.finishedWork = didTimeout; root.finishedLanes = lanes; a: { - switch (didTimeout) { + switch (exitStatus) { case 0: case 1: throw Error("Root did not complete. This is a bug in React."); @@ -8433,8 +8434,9 @@ function performConcurrentWorkOnRoot(root, didTimeout) { } if ( (lanes & 125829120) === lanes && - ((didTimeout = globalMostRecentFallbackTime + 500 - now$1()), - 10 < didTimeout) + (alwaysThrottleRetries || 3 === exitStatus) && + ((exitStatus = globalMostRecentFallbackTime + 500 - now$1()), + 10 < exitStatus) ) { markRootSuspended(root, lanes); if (0 !== getNextLanes(root, 0)) break a; @@ -8442,18 +8444,18 @@ function performConcurrentWorkOnRoot(root, didTimeout) { commitRootWhenReady.bind( null, root, - originallyAttemptedLanes, + didTimeout, workInProgressRootRecoverableErrors, workInProgressTransitions, lanes ), - didTimeout + exitStatus ); break a; } commitRootWhenReady( root, - originallyAttemptedLanes, + didTimeout, workInProgressRootRecoverableErrors, workInProgressTransitions, lanes @@ -10436,7 +10438,7 @@ var roots = new Map(), devToolsConfig$jscomp$inline_1178 = { findFiberByHostInstance: getInstanceFromTag, bundleType: 0, - version: "18.3.0-next-7f8c501f6-20230420", + version: "18.3.0-next-d73d7d590-20230420", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForViewTag: function () { @@ -10491,7 +10493,7 @@ var roots = new Map(), scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-7f8c501f6-20230420" + reconcilerVersion: "18.3.0-next-d73d7d590-20230420" }); exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = { computeComponentStackForErrorReporting: function (reactTag) {