Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit db6a797

Browse files
committedMar 6, 2025··
[dev-overlay] Stop grouping callstack frames into ignored vs. not ignored
1 parent 22812d4 commit db6a797

File tree

1 file changed

+9
-39
lines changed
  • packages/next/src/client/components/react-dev-overlay/ui/components/errors/call-stack

1 file changed

+9
-39
lines changed
 

‎packages/next/src/client/components/react-dev-overlay/ui/components/errors/call-stack/call-stack.tsx

+9-39
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,8 @@ export function CallStack({ frames, dialogResizerRef }: CallStackProps) {
1111
const initialDialogHeight = useRef<number>(NaN)
1212
const [isIgnoreListOpen, setIsIgnoreListOpen] = useState(false)
1313

14-
const { visibleFrames, ignoredFrames, ignoreListLength } = useMemo(() => {
15-
const visible: OriginalStackFrame[] = []
16-
const ignored: OriginalStackFrame[] = []
17-
18-
for (const frame of frames) {
19-
if (!frame.ignored) {
20-
visible.push(frame)
21-
}
22-
if (frame.ignored) {
23-
ignored.push(frame)
24-
}
25-
}
26-
27-
return {
28-
visibleFrames: visible,
29-
ignoredFrames: ignored,
30-
ignoreListLength: ignored.length,
31-
}
14+
const ignoredFramesTally = useMemo(() => {
15+
return frames.reduce((tally, frame) => tally + (frame.ignored ? 1 : 0), 0)
3216
}, [frames])
3317

3418
function onToggleIgnoreList() {
@@ -65,36 +49,22 @@ export function CallStack({ frames, dialogResizerRef }: CallStackProps) {
6549
{frames.length}
6650
</span>
6751
</p>
68-
{ignoreListLength > 0 && (
52+
{ignoredFramesTally > 0 && (
6953
<button
7054
data-expand-ignore-button={isIgnoreListOpen}
7155
className="error-overlay-call-stack-ignored-list-toggle-button"
7256
onClick={onToggleIgnoreList}
7357
>
74-
{`${isIgnoreListOpen ? 'Hide' : 'Show'} ${ignoreListLength} ignore-listed frames`}
58+
{`${isIgnoreListOpen ? 'Hide' : 'Show'} ${ignoredFramesTally} ignore-listed frame(s)`}
7559
<ChevronUpDown />
7660
</button>
7761
)}
7862
</div>
79-
{visibleFrames.map((frame, frameIndex) => (
80-
<CallStackFrame
81-
key={`call-stack-leading-${frameIndex}`}
82-
frame={frame}
83-
index={frameIndex}
84-
/>
85-
))}
86-
87-
{isIgnoreListOpen && (
88-
<>
89-
{ignoredFrames.map((frame, frameIndex) => (
90-
<CallStackFrame
91-
key={`call-stack-ignored-${frameIndex}`}
92-
frame={frame}
93-
index={frameIndex}
94-
/>
95-
))}
96-
</>
97-
)}
63+
{frames.map((frame, frameIndex) => {
64+
return !frame.ignored || isIgnoreListOpen ? (
65+
<CallStackFrame key={frameIndex} frame={frame} index={frameIndex} />
66+
) : null
67+
})}
9868
</div>
9969
)
10070
}

0 commit comments

Comments
 (0)
Please sign in to comment.