MCPcopy
hub / github.com/facebook/react / retryNode

Function retryNode

packages/react-server/src/ReactFizzServer.js:3320–3600  ·  view source on GitHub ↗
(request: Request, task: Task)

Source from the content-addressed store, hash-verified

3318}
3319
3320function retryNode(request: Request, task: Task): void {
3321 const node = task.node;
3322 const childIndex = task.childIndex;
3323
3324 if (node === null) {
3325 return;
3326 }
3327
3328 // Handle object types
3329 if (typeof node === 'object') {
3330 switch ((node: any).$$typeof) {
3331 case REACT_ELEMENT_TYPE: {
3332 const element: any = node;
3333 const type = element.type;
3334 const key = element.key;
3335 const props = element.props;
3336
3337 // TODO: We should get the ref off the props object right before using
3338 // it.
3339 const refProp = props.ref;
3340 const ref = refProp !== undefined ? refProp : null;
3341
3342 const debugTask: null | ConsoleTask = __DEV__ ? task.debugTask : null;
3343
3344 const name = getComponentNameFromType(type);
3345 const keyOrIndex =
3346 key == null ? (childIndex === -1 ? 0 : childIndex) : key;
3347 const keyPath = [task.keyPath, name, keyOrIndex];
3348 if (task.replay !== null) {
3349 if (debugTask) {
3350 debugTask.run(
3351 replayElement.bind(
3352 null,
3353 request,
3354 task,
3355 keyPath,
3356 name,
3357 keyOrIndex,
3358 childIndex,
3359 type,
3360 props,
3361 ref,
3362 task.replay,
3363 ),
3364 );
3365 } else {
3366 replayElement(
3367 request,
3368 task,
3369 keyPath,
3370 name,
3371 keyOrIndex,
3372 childIndex,
3373 type,
3374 props,
3375 ref,
3376 task.replay,
3377 );

Callers 3

renderNodeDestructiveFunction · 0.85
retryRenderTaskFunction · 0.85
retryReplayTaskFunction · 0.85

Calls 15

unwrapThenableFunction · 0.90
readContextFunction · 0.90
pushTextInstanceFunction · 0.90
getComponentNameFromTypeFunction · 0.85
replayElementFunction · 0.85
renderNodeDestructiveFunction · 0.85
isArrayFunction · 0.85
renderChildrenArrayFunction · 0.85
validateIterableFunction · 0.85
validateAsyncIterableFunction · 0.85

Tested by

no test coverage detected