Skip to content

Commit

Permalink
fix empty file source
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi committed Oct 23, 2024
1 parent c17ab93 commit afc0d79
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ export const CallStackFrame: React.FC<{
// e.g. (app-pages-browser)/./app/page.tsx -> ./app/page.tsx
const formattedMethod = f.methodName.replace(/^\([\w-]+\)\//, '')

// Formatted file source could be empty. e.g. <anonymous> will be formatted to empty string,
// we'll skip rendering the frame in this case.
const fileSource = getFrameSource(f)
if (!fileSource) {
return null
}

return (
<div data-nextjs-call-stack-frame>
<h3 data-nextjs-frame-expanded={Boolean(frame.expanded)}>
Expand All @@ -40,7 +47,7 @@ export const CallStackFrame: React.FC<{
onClick={open}
title={hasSource ? 'Click to open in your editor' : undefined}
>
<span>{getFrameSource(f)}</span>
<span>{fileSource}</span>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
Expand Down

0 comments on commit afc0d79

Please sign in to comment.