MCPcopy
hub / github.com/react/react / logComponentAborted

Function logComponentAborted

packages/react-client/src/ReactFlightPerformanceTrack.js:141–192  ·  view source on GitHub ↗
(
  componentInfo: ReactComponentInfo,
  trackIdx: number,
  startTime: number,
  endTime: number,
  childrenEndTime: number,
  rootEnv: string,
)

Source from the content-addressed store, hash-verified

139}
140
141export function logComponentAborted(
142 componentInfo: ReactComponentInfo,
143 trackIdx: number,
144 startTime: number,
145 endTime: number,
146 childrenEndTime: number,
147 rootEnv: string,
148): void {
149 if (supportsUserTiming) {
150 const env = componentInfo.env;
151 const name = componentInfo.name;
152 const isPrimaryEnv = env === rootEnv;
153 const entryName =
154 isPrimaryEnv || env === undefined ? name : name + ' [' + env + ']';
155 if (__DEV__) {
156 const properties: Array<[string, string]> = [
157 [
158 'Aborted',
159 'The stream was aborted before this Component finished rendering.',
160 ],
161 ];
162 if (componentInfo.key != null) {
163 addValueToProperties('key', componentInfo.key, properties, 0, '');
164 }
165 if (componentInfo.props != null) {
166 addObjectToProperties(componentInfo.props, properties, 0, '');
167 }
168 performance.measure('\u200b' + entryName, {
169 start: startTime < 0 ? 0 : startTime,
170 end: childrenEndTime,
171 detail: {
172 devtools: {
173 color: 'warning',
174 track: trackNames[trackIdx],
175 trackGroup: COMPONENTS_TRACK,
176 tooltipText: entryName + ' Aborted',
177 properties,
178 },
179 },
180 });
181 } else {
182 console.timeStamp(
183 entryName,
184 startTime < 0 ? 0 : startTime,
185 childrenEndTime,
186 trackNames[trackIdx],
187 COMPONENTS_TRACK,
188 'warning',
189 );
190 }
191 }
192}
193
194export function logComponentErrored(
195 componentInfo: ReactComponentInfo,

Callers

nothing calls this directly

Calls 3

addValueToPropertiesFunction · 0.90
addObjectToPropertiesFunction · 0.90
measureMethod · 0.65

Tested by

no test coverage detected