Skip to content

Commit f33a4b3

Browse files
authored
[dev-overlay] Dim ignore-listed callstack frames when shown (#76862)
1 parent dd4aca4 commit f33a4b3

File tree

3 files changed

+12
-16
lines changed

3 files changed

+12
-16
lines changed

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

+10-14
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ import { useOpenInEditor } from '../../utils/use-open-in-editor'
88

99
export const CallStackFrame: React.FC<{
1010
frame: OriginalStackFrame
11-
index: number
12-
}> = function CallStackFrame({ frame, index }) {
11+
}> = function CallStackFrame({ frame }) {
1312
// TODO: ability to expand resolved frames
1413

1514
const f: StackFrame = frame.originalStackFrame ?? frame.sourceStackFrame
@@ -39,17 +38,10 @@ export const CallStackFrame: React.FC<{
3938
return (
4039
<div
4140
data-nextjs-call-stack-frame
42-
data-nextjs-call-stack-frame-ignored={!hasSource}
43-
style={
44-
{
45-
'--index': index,
46-
} as React.CSSProperties
47-
}
41+
data-nextjs-call-stack-frame-no-source={!hasSource}
42+
data-nextjs-call-stack-frame-ignored={frame.ignored}
4843
>
49-
<div
50-
data-nextjs-frame-expanded={!frame.ignored}
51-
className="call-stack-frame-method-name"
52-
>
44+
<div className="call-stack-frame-method-name">
5345
<HotlinkedText text={formattedMethod} />
5446
{hasSource && (
5547
<button onClick={open} className="open-in-editor-button">
@@ -77,17 +69,21 @@ export const CallStackFrame: React.FC<{
7769
}
7870

7971
export const CALL_STACK_FRAME_STYLES = `
80-
[data-nextjs-call-stack-frame-ignored] {
72+
[data-nextjs-call-stack-frame-no-source] {
8173
padding: 6px 8px;
8274
margin-bottom: 4px;
8375
8476
border-radius: var(--rounded-lg);
8577
}
8678
87-
[data-nextjs-call-stack-frame-ignored]:last-child {
79+
[data-nextjs-call-stack-frame-no-source]:last-child {
8880
margin-bottom: 0;
8981
}
9082
83+
[data-nextjs-call-stack-frame-ignored="true"] {
84+
opacity: 0.6;
85+
}
86+
9187
[data-nextjs-call-stack-frame] {
9288
user-select: text;
9389
display: block;

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export function CallStack({ frames, dialogResizerRef }: CallStackProps) {
6262
</div>
6363
{frames.map((frame, frameIndex) => {
6464
return !frame.ignored || isIgnoreListOpen ? (
65-
<CallStackFrame key={frameIndex} frame={frame} index={frameIndex} />
65+
<CallStackFrame key={frameIndex} frame={frame} />
6666
) : null
6767
})}
6868
</div>

test/lib/next-test-utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1676,7 +1676,7 @@ export async function getStackFramesContent(browser) {
16761676
const stackFramesContent = (
16771677
await Promise.all(
16781678
stackFrameElements.map(async (frame) => {
1679-
const functionNameEl = await frame.$('[data-nextjs-frame-expanded]')
1679+
const functionNameEl = await frame.$('.call-stack-frame-method-name')
16801680
const sourceEl = await frame.$('[data-has-source="true"]')
16811681
const functionName = functionNameEl
16821682
? await functionNameEl.innerText()

0 commit comments

Comments
 (0)