mirror of
https://github.com/stefanpejcic/openpanel
synced 2025-06-26 18:28:26 +00:00
16 lines
398 B
TypeScript
16 lines
398 B
TypeScript
import type { StackFrame } from "error-stack-parser";
|
|
|
|
const unrelatedFunctionName = "renderWithHooks";
|
|
|
|
export const cleanStack = (stack: StackFrame[]) => {
|
|
const firstUnrelatedIndex = stack.findIndex(
|
|
(frame) => frame.functionName === unrelatedFunctionName,
|
|
);
|
|
|
|
if (firstUnrelatedIndex !== -1) {
|
|
return stack.slice(0, firstUnrelatedIndex);
|
|
}
|
|
|
|
return stack;
|
|
};
|