( request: Request, stack: ReactStackTrace, )
| 345 | } |
| 346 | |
| 347 | export function isAwaitInUserspace( |
| 348 | request: Request, |
| 349 | stack: ReactStackTrace, |
| 350 | ): boolean { |
| 351 | let firstFrame = 0; |
| 352 | while ( |
| 353 | stack.length > firstFrame && |
| 354 | isPromiseAwaitInternal(stack[firstFrame][1], stack[firstFrame][0]) |
| 355 | ) { |
| 356 | // Skip the internal frame that awaits itself. |
| 357 | firstFrame++; |
| 358 | } |
| 359 | if (stack.length > firstFrame) { |
| 360 | // Check if the very first stack frame that awaited this Promise was in user space. |
| 361 | // TODO: This doesn't take into account wrapper functions such as our fake .then() |
| 362 | // in FlightClient which will always be considered third party awaits if you call |
| 363 | // .then directly. |
| 364 | const filterStackFrame = request.filterStackFrame; |
| 365 | const callsite = stack[firstFrame]; |
| 366 | const functionName = callsite[0]; |
| 367 | const url = devirtualizeURL(callsite[1]); |
| 368 | const lineNumber = callsite[2]; |
| 369 | const columnNumber = callsite[3]; |
| 370 | return filterStackFrame(url, functionName, lineNumber, columnNumber); |
| 371 | } |
| 372 | return false; |
| 373 | } |
| 374 | |
| 375 | initAsyncDebugInfo(); |
| 376 |
no test coverage detected