Skip to content

Commit f51ef7b

Browse files
acdlitenevilm-lt
authored andcommitted
Remove logic for multiple error recovery attempts (facebook#23227)
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.
1 parent 59de4c9 commit f51ef7b

File tree

2 files changed

+2
-34
lines changed

2 files changed

+2
-34
lines changed

packages/react-reconciler/src/ReactFiberWorkLoop.new.js

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -894,23 +894,7 @@ function recoverFromConcurrentError(root, errorRetryLanes) {
894894
}
895895
}
896896

897-
let exitStatus;
898-
899-
const MAX_ERROR_RETRY_ATTEMPTS = 50;
900-
for (let i = 0; i < MAX_ERROR_RETRY_ATTEMPTS; i++) {
901-
exitStatus = renderRootSync(root, errorRetryLanes);
902-
if (
903-
exitStatus === RootErrored &&
904-
workInProgressRootRenderPhaseUpdatedLanes !== NoLanes
905-
) {
906-
// There was a render phase update during this render. Some internal React
907-
// implementation details may use this as a trick to schedule another
908-
// render pass. To protect against an inifinite loop, eventually
909-
// we'll give up.
910-
continue;
911-
}
912-
break;
913-
}
897+
const exitStatus = renderRootSync(root, errorRetryLanes);
914898

915899
executionContext = prevExecutionContext;
916900

packages/react-reconciler/src/ReactFiberWorkLoop.old.js

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -894,23 +894,7 @@ function recoverFromConcurrentError(root, errorRetryLanes) {
894894
}
895895
}
896896

897-
let exitStatus;
898-
899-
const MAX_ERROR_RETRY_ATTEMPTS = 50;
900-
for (let i = 0; i < MAX_ERROR_RETRY_ATTEMPTS; i++) {
901-
exitStatus = renderRootSync(root, errorRetryLanes);
902-
if (
903-
exitStatus === RootErrored &&
904-
workInProgressRootRenderPhaseUpdatedLanes !== NoLanes
905-
) {
906-
// There was a render phase update during this render. Some internal React
907-
// implementation details may use this as a trick to schedule another
908-
// render pass. To protect against an inifinite loop, eventually
909-
// we'll give up.
910-
continue;
911-
}
912-
break;
913-
}
897+
const exitStatus = renderRootSync(root, errorRetryLanes);
914898

915899
executionContext = prevExecutionContext;
916900

0 commit comments

Comments
 (0)