| 4458 | if (endTimeIdx > -1) { |
| 4459 | // Now that we know the start and end time, we can emit the entries between. |
| 4460 | for (let j = endTimeIdx - 1; j > i; j--) { |
| 4461 | const candidateInfo = debugInfo[j]; |
| 4462 | if (typeof candidateInfo.name === 'string') { |
| 4463 | if (componentEndTime > childrenEndTime) { |
| 4464 | childrenEndTime = componentEndTime; |
| 4465 | } |
| 4466 | // $FlowFixMe: Refined. |
| 4467 | const componentInfo: ReactComponentInfo = candidateInfo; |
| 4468 | logComponentInfo( |
| 4469 | response, |
| 4470 | root, |
| 4471 | componentInfo, |
| 4472 | trackIdx, |
| 4473 | time, |
| 4474 | componentEndTime, |
| 4475 | childrenEndTime, |
| 4476 | isLastComponent, |
| 4477 | ); |
| 4478 | componentEndTime = time; // The end time of previous component is the start time of the next. |
| 4479 | // Track the root most component of the result for deduping logging. |
| 4480 | result.component = componentInfo; |
| 4481 | isLastComponent = false; |
| 4482 | } else if ( |
| 4483 | candidateInfo.awaited && |
| 4484 | // Skip awaits on client resources since they didn't block the server component. |
| 4485 | candidateInfo.awaited.env != null |
| 4486 | ) { |
| 4487 | if (endTime > childrenEndTime) { |
| 4488 | childrenEndTime = endTime; |
| 4489 | } |
| 4490 | // $FlowFixMe: Refined. |
| 4491 | const asyncInfo: ReactAsyncInfo = candidateInfo; |
| 4492 | const env = response._rootEnvironmentName; |
| 4493 | const promise = asyncInfo.awaited.value; |
| 4494 | if (promise) { |
| 4495 | const thenable: Thenable<mixed> = (promise: any); |
| 4496 | switch (thenable.status) { |
| 4497 | case INITIALIZED: |
| 4498 | logComponentAwait( |
| 4499 | asyncInfo, |
| 4500 | trackIdx, |
| 4501 | time, |
| 4502 | endTime, |
| 4503 | env, |
| 4504 | thenable.value, |
| 4505 | ); |
| 4506 | break; |
| 4507 | case ERRORED: |
| 4508 | logComponentAwaitErrored( |
| 4509 | asyncInfo, |
| 4510 | trackIdx, |
| 4511 | time, |
| 4512 | endTime, |
| 4513 | env, |
| 4514 | thenable.reason, |
| 4515 | ); |
| 4516 | break; |
| 4517 | default: |