From a95f9016ec6eaf397eb36beab87cf8d164f3a7c3 Mon Sep 17 00:00:00 2001 From: devjiwonchoi Date: Wed, 18 Dec 2024 01:54:01 +0900 Subject: [PATCH] delete unused grouped-stack-frames added before reordering stack --- .../RuntimeError/GroupedStackFrames.tsx | 59 ---------- .../group-stack-frames-by-framework.ts | 51 --------- .../internal/icons/FrameworkIcon.tsx | 101 ------------------ 3 files changed, 211 deletions(-) delete mode 100644 packages/next/src/client/components/react-dev-overlay/_experimental/internal/container/RuntimeError/GroupedStackFrames.tsx delete mode 100644 packages/next/src/client/components/react-dev-overlay/_experimental/internal/helpers/group-stack-frames-by-framework.ts delete mode 100644 packages/next/src/client/components/react-dev-overlay/_experimental/internal/icons/FrameworkIcon.tsx diff --git a/packages/next/src/client/components/react-dev-overlay/_experimental/internal/container/RuntimeError/GroupedStackFrames.tsx b/packages/next/src/client/components/react-dev-overlay/_experimental/internal/container/RuntimeError/GroupedStackFrames.tsx deleted file mode 100644 index 1a6ea345b61889..00000000000000 --- a/packages/next/src/client/components/react-dev-overlay/_experimental/internal/container/RuntimeError/GroupedStackFrames.tsx +++ /dev/null @@ -1,59 +0,0 @@ -import type { StackFramesGroup } from '../../helpers/group-stack-frames-by-framework' -import { CallStackFrame } from './CallStackFrame' -import { CollapseIcon } from '../../icons/CollapseIcon' -import { FrameworkIcon } from '../../icons/FrameworkIcon' - -function FrameworkGroup({ - framework, - stackFrames, -}: { - framework: NonNullable - stackFrames: StackFramesGroup['stackFrames'] -}) { - return ( -
- {/* Match CallStackFrame tabIndex */} - - - - {framework === 'react' ? 'React' : 'Next.js'} - - {stackFrames.map((frame, index) => ( - - ))} -
- ) -} - -export function GroupedStackFrames({ - groupedStackFrames, -}: { - groupedStackFrames: StackFramesGroup[] -}) { - return ( - <> - {groupedStackFrames.map((stackFramesGroup, groupIndex) => { - // Collapse React and Next.js frames - if (stackFramesGroup.framework) { - return ( - - ) - } - - return ( - // Don't group non React and Next.js frames - stackFramesGroup.stackFrames.map((frame, frameIndex) => ( - - )) - ) - })} - - ) -} diff --git a/packages/next/src/client/components/react-dev-overlay/_experimental/internal/helpers/group-stack-frames-by-framework.ts b/packages/next/src/client/components/react-dev-overlay/_experimental/internal/helpers/group-stack-frames-by-framework.ts deleted file mode 100644 index fb03357809ec28..00000000000000 --- a/packages/next/src/client/components/react-dev-overlay/_experimental/internal/helpers/group-stack-frames-by-framework.ts +++ /dev/null @@ -1,51 +0,0 @@ -import type { SourcePackage } from '../../../server/shared' -import type { OriginalStackFrame } from './stack-frame' - -export type StackFramesGroup = { - framework?: SourcePackage | null - stackFrames: OriginalStackFrame[] -} - -/** - * Group sequences of stack frames by framework. - * - * Given the following stack frames: - * Error - * user code - * user code - * react - * react - * next - * next - * react - * react - * - * The grouped stack frames would be: - * > user code - * > react - * > next - * > react - * - */ -export function groupStackFramesByFramework( - stackFrames: OriginalStackFrame[] -): StackFramesGroup[] { - const stackFramesGroupedByFramework: StackFramesGroup[] = [] - - for (const stackFrame of stackFrames) { - const currentGroup = - stackFramesGroupedByFramework[stackFramesGroupedByFramework.length - 1] - const framework = stackFrame.sourcePackage - - if (currentGroup && currentGroup.framework === framework) { - currentGroup.stackFrames.push(stackFrame) - } else { - stackFramesGroupedByFramework.push({ - framework: framework, - stackFrames: [stackFrame], - }) - } - } - - return stackFramesGroupedByFramework -} diff --git a/packages/next/src/client/components/react-dev-overlay/_experimental/internal/icons/FrameworkIcon.tsx b/packages/next/src/client/components/react-dev-overlay/_experimental/internal/icons/FrameworkIcon.tsx deleted file mode 100644 index e161a4aa9c3ffe..00000000000000 --- a/packages/next/src/client/components/react-dev-overlay/_experimental/internal/icons/FrameworkIcon.tsx +++ /dev/null @@ -1,101 +0,0 @@ -import type { StackFramesGroup } from '../helpers/group-stack-frames-by-framework' - -export function FrameworkIcon({ - framework, -}: { - framework: NonNullable -}) { - if (framework === 'react') { - return ( - - - - - ) - } - - return ( - - - - - - - - - - - - - - - - - - - - - ) -}