( request: Request, task: Task, debugInfo: ReactDebugInfo, )
| 5241 | } |
| 5242 | |
| 5243 | function forwardDebugInfo( |
| 5244 | request: Request, |
| 5245 | task: Task, |
| 5246 | debugInfo: ReactDebugInfo, |
| 5247 | ) { |
| 5248 | const id = task.id; |
| 5249 | for (let i = 0; i < debugInfo.length; i++) { |
| 5250 | const info = debugInfo[i]; |
| 5251 | if (typeof info.time === 'number') { |
| 5252 | // When forwarding time we need to ensure to convert it to the time space of the payload. |
| 5253 | // We clamp the time to the starting render of the current component. It's as if it took |
| 5254 | // no time to render and await if we reuse cached content. |
| 5255 | markOperationEndTime(request, task, info.time); |
| 5256 | } else { |
| 5257 | if (typeof info.name === 'string') { |
| 5258 | // We outline this model eagerly so that we can refer to by reference as an owner. |
| 5259 | // If we had a smarter way to dedupe we might not have to do this if there ends up |
| 5260 | // being no references to this as an owner. |
| 5261 | outlineComponentInfo(request, (info: any)); |
| 5262 | // Emit a reference to the outlined one. |
| 5263 | request.pendingChunks++; |
| 5264 | emitDebugChunk(request, id, info); |
| 5265 | } else if (info.awaited) { |
| 5266 | const ioInfo = info.awaited; |
| 5267 | if (ioInfo.end <= request.timeOrigin) { |
| 5268 | // This was already resolved when we started this render. It must have been some |
| 5269 | // externally cached data. We exclude that information but we keep components and |
| 5270 | // awaits that happened inside this render but might have been deduped within the |
| 5271 | // render. |
| 5272 | } else { |
| 5273 | // Outline the IO info in case the same I/O is awaited in more than one place. |
| 5274 | outlineIOInfo(request, ioInfo); |
| 5275 | // Ensure the owner is already outlined. |
| 5276 | if (info.owner != null) { |
| 5277 | outlineComponentInfo(request, info.owner); |
| 5278 | } |
| 5279 | // We can't serialize the ConsoleTask/Error objects so we need to omit them before serializing. |
| 5280 | let debugStack; |
| 5281 | if (info.stack == null && info.debugStack != null) { |
| 5282 | // If we have a debugStack but no parsed stack we should parse it. |
| 5283 | debugStack = filterStackTrace( |
| 5284 | request, |
| 5285 | parseStackTrace(info.debugStack, 1), |
| 5286 | ); |
| 5287 | } else { |
| 5288 | debugStack = info.stack; |
| 5289 | } |
| 5290 | const debugAsyncInfo: Omit< |
| 5291 | ReactAsyncInfo, |
| 5292 | 'debugTask' | 'debugStack', |
| 5293 | > = { |
| 5294 | awaited: ioInfo, |
| 5295 | }; |
| 5296 | if (info.env != null) { |
| 5297 | // $FlowFixMe[cannot-write] |
| 5298 | debugAsyncInfo.env = info.env; |
| 5299 | } |
| 5300 | if (info.owner != null) { |
no test coverage detected