( task: Task, debugInfo: void | null | ReactDebugInfo, )
| 1032 | } |
| 1033 | |
| 1034 | function pushServerComponentStack( |
| 1035 | task: Task, |
| 1036 | debugInfo: void | null | ReactDebugInfo, |
| 1037 | ): void { |
| 1038 | if (!__DEV__) { |
| 1039 | // eslint-disable-next-line react-internal/prod-error-codes |
| 1040 | throw new Error( |
| 1041 | 'pushServerComponentStack should never be called in production. This is a bug in React.', |
| 1042 | ); |
| 1043 | } |
| 1044 | // Build a Server Component parent stack from the debugInfo. |
| 1045 | if (debugInfo != null) { |
| 1046 | const stack: ReactDebugInfo = debugInfo; |
| 1047 | for (let i = 0; i < stack.length; i++) { |
| 1048 | const componentInfo: ReactComponentInfo = (stack[i]: any); |
| 1049 | if (typeof componentInfo.name !== 'string') { |
| 1050 | continue; |
| 1051 | } |
| 1052 | if (componentInfo.debugStack === undefined) { |
| 1053 | continue; |
| 1054 | } |
| 1055 | task.componentStack = { |
| 1056 | parent: task.componentStack, |
| 1057 | type: componentInfo, |
| 1058 | owner: componentInfo.owner, |
| 1059 | stack: componentInfo.debugStack, |
| 1060 | }; |
| 1061 | task.debugTask = (componentInfo.debugTask: any); |
| 1062 | } |
| 1063 | } |
| 1064 | } |
| 1065 | |
| 1066 | function pushComponentStack(task: Task): void { |
| 1067 | const node = task.node; |
no outgoing calls
no test coverage detected