( request: Request, stack: ReactStackTrace, )
| 267 | } |
| 268 | |
| 269 | function filterStackTrace( |
| 270 | request: Request, |
| 271 | stack: ReactStackTrace, |
| 272 | ): ReactStackTrace { |
| 273 | // Since stacks can be quite large and we pass a lot of them, we filter them out eagerly |
| 274 | // to save bandwidth even in DEV. We'll also replay these stacks on the client so by |
| 275 | // stripping them early we avoid that overhead. Otherwise we'd normally just rely on |
| 276 | // the DevTools or framework's ignore lists to filter them out. |
| 277 | const filterStackFrame = request.filterStackFrame; |
| 278 | const filteredStack: ReactStackTrace = []; |
| 279 | for (let i = 0; i < stack.length; i++) { |
| 280 | const callsite = stack[i]; |
| 281 | const functionName = callsite[0]; |
| 282 | const url = devirtualizeURL(callsite[1]); |
| 283 | const lineNumber = callsite[2]; |
| 284 | const columnNumber = callsite[3]; |
| 285 | if (filterStackFrame(url, functionName, lineNumber, columnNumber)) { |
| 286 | // Use a clone because the Flight protocol isn't yet resilient to deduping |
| 287 | // objects in the debug info. TODO: Support deduping stacks. |
| 288 | const clone: ReactCallSite = (callsite.slice(0): any); |
| 289 | clone[1] = url; |
| 290 | filteredStack.push(clone); |
| 291 | } |
| 292 | } |
| 293 | return filteredStack; |
| 294 | } |
| 295 | |
| 296 | function hasUnfilteredFrame(request: Request, stack: ReactStackTrace): boolean { |
| 297 | const filterStackFrame = request.filterStackFrame; |
no test coverage detected