MCPcopy Index your code
hub / github.com/react/react / filterStackTrace

Function filterStackTrace

packages/react-server/src/ReactFlightServer.js:269–294  ·  view source on GitHub ↗
(
  request: Request,
  stack: ReactStackTrace,
)

Source from the content-addressed store, hash-verified

267}
268
269function 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
296function hasUnfilteredFrame(request: Request, stack: ReactStackTrace): boolean {
297 const filterStackFrame = request.filterStackFrame;

Callers 15

wrapperMethodFunction · 0.85
renderFunctionComponentFunction · 0.85
renderClientElementFunction · 0.85
renderElementFunction · 0.85
visitAsyncNodeFunction · 0.85
emitAsyncSequenceFunction · 0.85
emitPostponeChunkFunction · 0.85
serializeErrorValueFunction · 0.85
serializeDebugErrorValueFunction · 0.85
emitErrorChunkFunction · 0.85
outlineComponentInfoFunction · 0.85

Calls 3

devirtualizeURLFunction · 0.85
pushMethod · 0.65
filterStackFrameFunction · 0.50

Tested by

no test coverage detected