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

Function pushComponentStack

packages/react-server/src/ReactFizzServer.js:1066–1108  ·  view source on GitHub ↗
(task: Task)

Source from the content-addressed store, hash-verified

1064}
1065
1066function pushComponentStack(task: Task): void {
1067 const node = task.node;
1068 // Create the Component Stack frame for the element we're about to try.
1069 // It's unfortunate that we need to do this refinement twice. Once for
1070 // the stack frame and then once again while actually
1071 if (typeof node === 'object' && node !== null) {
1072 switch ((node: any).$$typeof) {
1073 case REACT_ELEMENT_TYPE: {
1074 const element: any = node;
1075 const type = element.type;
1076 const owner = __DEV__ ? element._owner : null;
1077 const stack = __DEV__ ? element._debugStack : null;
1078 if (__DEV__) {
1079 pushServerComponentStack(task, element._debugInfo);
1080 task.debugTask = element._debugTask;
1081 }
1082 task.componentStack = createComponentStackFromType(
1083 task.componentStack,
1084 type,
1085 owner,
1086 stack,
1087 );
1088 break;
1089 }
1090 case REACT_LAZY_TYPE: {
1091 if (__DEV__) {
1092 const lazyNode: LazyComponentType<any, any> = (node: any);
1093 pushServerComponentStack(task, lazyNode._debugInfo);
1094 }
1095 break;
1096 }
1097 default: {
1098 if (__DEV__) {
1099 const maybeUsable: Object = node;
1100 if (typeof maybeUsable.then === 'function') {
1101 const thenable: Thenable<ReactNodeList> = (maybeUsable: any);
1102 pushServerComponentStack(task, thenable._debugInfo);
1103 }
1104 }
1105 }
1106 }
1107 }
1108}
1109
1110function createComponentStackFromType(
1111 parent: null | ComponentStackNode,

Callers 5

createRequestFunction · 0.85
resumeRequestFunction · 0.85
renderSuspenseBoundaryFunction · 0.85
replaySuspenseBoundaryFunction · 0.85
renderNodeDestructiveFunction · 0.85

Calls 2

pushServerComponentStackFunction · 0.85

Tested by

no test coverage detected