Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Change the variable name inside the retryTask function #31543

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions packages/react-server/src/ReactFlightServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -4041,7 +4041,7 @@ function retryTask(request: Request, task: Task): void {
return;
}

const x =
const suspenseOrError =
thrownValue === SuspenseException
? // This is a special type of exception used for Suspense. For historical
// reasons, the rest of the Suspense implementation expects the thrown
Expand All @@ -4050,19 +4050,22 @@ function retryTask(request: Request, task: Task): void {
// later, once we deprecate the old API in favor of `use`.
getSuspendedThenable()
: thrownValue;
if (typeof x === 'object' && x !== null) {
if (typeof suspenseOrError === 'object' && suspenseOrError !== null) {
// $FlowFixMe[method-unbinding]
if (typeof x.then === 'function') {
if (typeof suspenseOrError.then === 'function') {
// Something suspended again, let's pick it back up later.
task.status = PENDING;
task.thenableState = getThenableStateAfterSuspending();
const ping = task.ping;
x.then(ping, ping);
suspenseOrError.then(ping, ping);
return;
} else if (enablePostpone && x.$$typeof === REACT_POSTPONE_TYPE) {
} else if (
enablePostpone &&
suspenseOrError.$$typeof === REACT_POSTPONE_TYPE
) {
request.abortableTasks.delete(task);
task.status = ERRORED;
const postponeInstance: Postpone = (x: any);
const postponeInstance: Postpone = (suspenseOrError: any);
logPostpone(request, postponeInstance.message, task);
emitPostponeChunk(request, task.id, postponeInstance);
return;
Expand All @@ -4071,8 +4074,8 @@ function retryTask(request: Request, task: Task): void {

request.abortableTasks.delete(task);
task.status = ERRORED;
const digest = logRecoverableError(request, x, task);
emitErrorChunk(request, task.id, digest, x);
const digest = logRecoverableError(request, suspenseOrError, task);
emitErrorChunk(request, task.id, digest, suspenseOrError);
} finally {
if (__DEV__) {
debugID = prevDebugID;
Expand Down