Repository: facebook/react
File: packages/react-server/src/ReactFizzServer.js (JavaScript)

Code before:

    if (typeof x === 'object' && x !== null) {
      // $FlowFixMe[method-unbinding]
      if (typeof x.then === 'function') {
        // Something suspended again, let's pick it back up later.
        segment.status = PENDING;
        task.thenableState = getThenableStateAfterSuspending();
        const ping = task.ping;
        x.then(ping, ping);
        return;
      } else if (
        enablePostpone &&
        request.trackedPostpones !== null &&
        x.$$typeof === REACT_POSTPONE_TYPE
      ) {
        // If we're tracking postpones, we mark this segment as postponed and finish
        // the task without filling it in. If we're not tracking, we treat it more like
        // an error.
        const trackedPostpones = request.trackedPostpones;
        task.abortSet.delete(task);
        const postponeInstance: Postpone = (x: any);

        const postponeInfo = getThrownInfo(task.componentStack);
        logPostpone(
          request,
          postponeInstance.message,
          postponeInfo,
          __DEV__ && enableOwnerStacks ? task.debugTask : null,
        );
        trackPostpone(request, trackedPostpones, task, segment);
        finishedTask(request, task.blockedBoundary, segment);
        return;
      }
    }

    const errorInfo = getThrownInfo(task.componentStack);
    task.abortSet.delete(task);

    if (x === AbortSigil) {
      segment.status = ABORTED;
      erroredTask(
        request,
        task.blockedBoundary,
        request.fatalError,
        errorInfo,
        __DEV__ && enableOwnerStacks ? task.debugTask : null,
      );
    } else {
      segment.status = ERRORED;
      erroredTask(
        request,

Review comment (suggestion):
If we abort sync in a resume, this can happen too right? Therefore you need to handle the same thing in `retryReplayTask`.

Code after:
        x.$$typeof === REACT_POSTPONE_TYPE
      ) {
        // If we're tracking postpones, we mark this segment as postponed and finish
        // the task without filling it in. If we're not tracking, we treat it more like
        // an error.
        const trackedPostpones = request.trackedPostpones;
        task.abortSet.delete(task);
        const postponeInstance: Postpone = (x: any);

        const postponeInfo = getThrownInfo(task.componentStack);
        logPostpone(
          request,
          postponeInstance.message,
          postponeInfo,
          __DEV__ && enableOwnerStacks ? task.debugTask : null,
        );
        trackPostpone(request, trackedPostpones, task, segment);
        finishedTask(request, task.blockedBoundary, segment);
        return;
      }
    }

    const errorInfo = getThrownInfo(task.componentStack);
    task.abortSet.delete(task);

    if (x === AbortSigil) {
      segment.status = ABORTED;
      erroredTask(
        request,
        task.blockedBoundary,
        request.fatalError,
        errorInfo,
        __DEV__ && enableOwnerStacks ? task.debugTask : null,
      );
    } else {
      segment.status = ERRORED;
      erroredTask(
        request,
        task.blockedBoundary,
        x,
        errorInfo,
        __DEV__ && enableOwnerStacks ? task.debugTask : null,
      );
    }
    return;
  } finally {
    if (__DEV__) {
      setCurrentTaskInDEV(prevTaskInDEV);
    }
  }
}