Skip to content

Commit ec08d8d

Browse files
committed
address review
1 parent 892e7fc commit ec08d8d

File tree

4 files changed

+15
-36
lines changed

4 files changed

+15
-36
lines changed

packages/next/src/client/components/react-dev-overlay/internal/helpers/group-stack-frames-by-framework.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
import type { SourcePackage } from '../../server/shared'
12
import type { OriginalStackFrame } from './stack-frame'
23

34
export type StackFramesGroup = {
4-
framework?: OriginalStackFrame['sourcePackage']
5+
framework?: SourcePackage | null
56
stackFrames: OriginalStackFrame[]
67
}
78

packages/next/src/client/components/react-dev-overlay/internal/helpers/stack-frame.ts

Lines changed: 7 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,13 @@
11
import type { StackFrame } from 'next/dist/compiled/stacktrace-parser'
22
import type { OriginalStackFrameResponse } from '../../server/shared'
33

4-
export type OriginalStackFrame =
5-
| {
6-
error: true
7-
reason: string
8-
external: false
9-
expanded: false
10-
sourceStackFrame: StackFrame
11-
originalStackFrame: null
12-
originalCodeFrame: null
13-
sourcePackage: OriginalStackFrameResponse['sourcePackage']
14-
}
15-
| {
16-
error: false
17-
reason: null
18-
external: false
19-
expanded: boolean
20-
sourceStackFrame: StackFrame
21-
originalStackFrame: StackFrame
22-
originalCodeFrame: string | null
23-
sourcePackage: OriginalStackFrameResponse['sourcePackage']
24-
}
25-
| {
26-
error: false
27-
reason: null
28-
external: true
29-
expanded: false
30-
sourceStackFrame: StackFrame
31-
originalStackFrame: null
32-
originalCodeFrame: null
33-
sourcePackage: OriginalStackFrameResponse['sourcePackage']
34-
}
4+
export interface OriginalStackFrame extends OriginalStackFrameResponse {
5+
error: boolean
6+
reason: string | null
7+
external: boolean
8+
expanded: boolean
9+
sourceStackFrame: StackFrame
10+
}
3511

3612
function getOriginalStackFrame(
3713
source: StackFrame,

packages/next/src/client/components/react-dev-overlay/server/middleware-turbopack.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ async function batchedTraceSource(
7171
export async function createOriginalStackFrame(
7272
project: Project,
7373
frame: TurbopackStackFrame
74-
): Promise<Partial<OriginalStackFrameResponse> | null> {
74+
): Promise<OriginalStackFrameResponse | null> {
7575
const traced = await batchedTraceSource(project, frame)
7676
if (!traced) {
7777
const sourcePackage = findSourcePackage(frame.file)

packages/next/src/client/components/react-dev-overlay/server/shared.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import type { StackFrame } from 'stacktrace-parser'
22

3+
export type SourcePackage = 'react' | 'next'
4+
35
export type OriginalStackFrameResponse = {
4-
originalStackFrame: StackFrame
5-
originalCodeFrame: string | null
6+
originalStackFrame?: StackFrame | null
7+
originalCodeFrame?: string | null
68
/** We use this to group frames in the error overlay */
7-
sourcePackage: 'react' | 'next' | null
9+
sourcePackage?: SourcePackage | null
810
}
911

1012
/** React that's compiled with `next`. Used by App Router. */

0 commit comments

Comments
 (0)