From 5318971f50da06fd42763689826acecdb14b4c5e Mon Sep 17 00:00:00 2001 From: Andrew Clark Date: Wed, 2 Feb 2022 13:14:20 -0800 Subject: [PATCH] Remove logic for multiple error recovery attempts (#23227) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This deletes some internal behavior that was only used by useOpaqueIdentifier, as an implementation detail: if an update is scheduled during the render phase, and something threw an error, we would try rendering again, either until there were no more errors or until there were no more render phase updates. This was not a publicly defined behavior — regular render phase updates are accompanied by a warning. Because useOpaqueIdentifier has been replaced by useId, and does not rely on this implementation detail, we can delete this code. --- .../src/ReactFiberWorkLoop.new.js | 18 +----------------- .../src/ReactFiberWorkLoop.old.js | 18 +----------------- 2 files changed, 2 insertions(+), 34 deletions(-) diff --git a/packages/react-reconciler/src/ReactFiberWorkLoop.new.js b/packages/react-reconciler/src/ReactFiberWorkLoop.new.js index b4b333547c194..d5372999f3c46 100644 --- a/packages/react-reconciler/src/ReactFiberWorkLoop.new.js +++ b/packages/react-reconciler/src/ReactFiberWorkLoop.new.js @@ -894,23 +894,7 @@ function recoverFromConcurrentError(root, errorRetryLanes) { } } - let exitStatus; - - const MAX_ERROR_RETRY_ATTEMPTS = 50; - for (let i = 0; i < MAX_ERROR_RETRY_ATTEMPTS; i++) { - exitStatus = renderRootSync(root, errorRetryLanes); - if ( - exitStatus === RootErrored && - workInProgressRootRenderPhaseUpdatedLanes !== NoLanes - ) { - // There was a render phase update during this render. Some internal React - // implementation details may use this as a trick to schedule another - // render pass. To protect against an inifinite loop, eventually - // we'll give up. - continue; - } - break; - } + const exitStatus = renderRootSync(root, errorRetryLanes); executionContext = prevExecutionContext; diff --git a/packages/react-reconciler/src/ReactFiberWorkLoop.old.js b/packages/react-reconciler/src/ReactFiberWorkLoop.old.js index d8bb61af50c84..92be9f0a323a9 100644 --- a/packages/react-reconciler/src/ReactFiberWorkLoop.old.js +++ b/packages/react-reconciler/src/ReactFiberWorkLoop.old.js @@ -894,23 +894,7 @@ function recoverFromConcurrentError(root, errorRetryLanes) { } } - let exitStatus; - - const MAX_ERROR_RETRY_ATTEMPTS = 50; - for (let i = 0; i < MAX_ERROR_RETRY_ATTEMPTS; i++) { - exitStatus = renderRootSync(root, errorRetryLanes); - if ( - exitStatus === RootErrored && - workInProgressRootRenderPhaseUpdatedLanes !== NoLanes - ) { - // There was a render phase update during this render. Some internal React - // implementation details may use this as a trick to schedule another - // render pass. To protect against an inifinite loop, eventually - // we'll give up. - continue; - } - break; - } + const exitStatus = renderRootSync(root, errorRetryLanes); executionContext = prevExecutionContext;