Repository: facebook/react
File: packages/react/src/ReactLazy.js (JavaScript)

Code before:
    // happens if the ctor or any wrappers processing the ctor throws. This might
    // end up fixing it if the resolution was a concurrency bug.
    thenable.then(
      moduleObject => {
        if (
          (payload: Payload<T>)._status === Pending ||
          payload._status === Uninitialized
        ) {
          // Transition to the next state.
          const resolved: ResolvedPayload<T> = (payload: any);
          resolved._status = Resolved;
          resolved._result = moduleObject;
          if (__DEV__) {
            const ioInfo = payload._ioInfo;
            if (ioInfo != null) {
              // Mark the end time of when we resolved.
              // $FlowFixMe[cannot-write]
              ioInfo.end = performance.now();
              // Surface the default export as the resolved "value" for debug purposes.
              const debugValue =
                moduleObject == null ? undefined : moduleObject.default;
              resolveDebugValue(debugValue);
              // $FlowFixMe
              ioInfo.value.status = 'fulfilled';
              // $FlowFixMe
              ioInfo.value.value = debugValue;
            }
            // Make the thenable introspectable
            if (thenable.status === undefined) {
              const fulfilledThenable: FulfilledThenable<{default: T, ...}> =
                (thenable: any);
              fulfilledThenable.status = 'fulfilled';
              fulfilledThenable.value = moduleObject;
            }
          }
        }
      },
      error => {
        if (
          (payload: Payload<T>)._status === Pending ||
          payload._status === Uninitialized
        ) {
          // Transition to the next state.
          const rejected: RejectedPayload = (payload: any);
          rejected._status = Rejected;
          rejected._result = error;
          if (__DEV__ && enableAsyncDebugInfo) {
            const ioInfo = payload._ioInfo;
            if (ioInfo != null) {
              // Mark the end time of when we rejected.
              // $FlowFixMe[cannot-write]

Review comment (bug):
This block isn't gated on `enableAsyncDebugInfo` but `resolveDebugValue` is only callable with `enableAsyncDebugInfo`. `enableAsyncDebugInfo` isn't enabled everywhere at the moment.

Code after:
    // happens if the ctor or any wrappers processing the ctor throws. This might
    // end up fixing it if the resolution was a concurrency bug.
    thenable.then(
      moduleObject => {
        if (
          (payload: Payload<T>)._status === Pending ||
          payload._status === Uninitialized
        ) {
          // Transition to the next state.
          const resolved: ResolvedPayload<T> = (payload: any);
          resolved._status = Resolved;
          resolved._result = moduleObject;
          if (__DEV__ && enableAsyncDebugInfo) {
            const ioInfo = payload._ioInfo;
            if (ioInfo != null) {
              // Mark the end time of when we resolved.
              // $FlowFixMe[cannot-write]
              ioInfo.end = performance.now();
              // Surface the default export as the resolved "value" for debug purposes.
              const debugValue =
                moduleObject == null ? undefined : moduleObject.default;
              resolveDebugValue(debugValue);
              // $FlowFixMe
              ioInfo.value.status = 'fulfilled';
              // $FlowFixMe
              ioInfo.value.value = debugValue;
            }
            // Make the thenable introspectable
            if (thenable.status === undefined) {
              const fulfilledThenable: FulfilledThenable<{default: T, ...}> =
                (thenable: any);
              fulfilledThenable.status = 'fulfilled';
              fulfilledThenable.value = moduleObject;
            }
          }
        }
      },
      error => {
        if (
          (payload: Payload<T>)._status === Pending ||
          payload._status === Uninitialized
        ) {
          // Transition to the next state.
          const rejected: RejectedPayload = (payload: any);
          rejected._status = Rejected;
          rejected._result = error;
          if (__DEV__ && enableAsyncDebugInfo) {
            const ioInfo = payload._ioInfo;
            if (ioInfo != null) {
              // Mark the end time of when we rejected.
              // $FlowFixMe[cannot-write]