MCPcopy Index your code
hub / github.com/react/react / logComponentAwait

Function logComponentAwait

packages/react-client/src/ReactFlightPerformanceTrack.js:469–528  ·  view source on GitHub ↗
(
  asyncInfo: ReactAsyncInfo,
  trackIdx: number,
  startTime: number,
  endTime: number,
  rootEnv: string,
  value: mixed,
)

Source from the content-addressed store, hash-verified

467}
468
469export function logComponentAwait(
470 asyncInfo: ReactAsyncInfo,
471 trackIdx: number,
472 startTime: number,
473 endTime: number,
474 rootEnv: string,
475 value: mixed,
476): void {
477 if (supportsUserTiming && endTime > 0) {
478 const description = getIODescription(value);
479 const name = getIOShortName(
480 asyncInfo.awaited,
481 description,
482 asyncInfo.env,
483 rootEnv,
484 );
485 const entryName = 'await ' + name;
486 const color = getIOColor(name);
487 const debugTask = asyncInfo.debugTask || asyncInfo.awaited.debugTask;
488 if (__DEV__ && debugTask) {
489 const properties: Array<[string, string]> = [];
490 if (typeof value === 'object' && value !== null) {
491 addObjectToProperties(value, properties, 0, '');
492 } else if (value !== undefined) {
493 addValueToProperties('awaited value', value, properties, 0, '');
494 }
495 const tooltipText = getIOLongName(
496 asyncInfo.awaited,
497 description,
498 asyncInfo.env,
499 rootEnv,
500 );
501 debugTask.run(
502 // $FlowFixMe[method-unbinding]
503 performance.measure.bind(performance, entryName, {
504 start: startTime < 0 ? 0 : startTime,
505 end: endTime,
506 detail: {
507 devtools: {
508 color: color,
509 track: trackNames[trackIdx],
510 trackGroup: COMPONENTS_TRACK,
511 properties,
512 tooltipText,
513 },
514 },
515 }),
516 );
517 } else {
518 console.timeStamp(
519 entryName,
520 startTime < 0 ? 0 : startTime,
521 endTime,
522 trackNames[trackIdx],
523 COMPONENTS_TRACK,
524 color,
525 );
526 }

Callers 1

forFunction · 0.90

Calls 7

getIODescriptionFunction · 0.90
addObjectToPropertiesFunction · 0.90
addValueToPropertiesFunction · 0.90
getIOShortNameFunction · 0.85
getIOColorFunction · 0.85
getIOLongNameFunction · 0.85
runMethod · 0.80

Tested by

no test coverage detected