Skip to content

Commit

Permalink
Remove the bottom collapse button in dev overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi committed Oct 23, 2024
1 parent aed6c4c commit e5da0a0
Showing 1 changed file with 12 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,30 +33,18 @@ export function RuntimeError({ error }: RuntimeErrorProps) {
}
}, [error.frames])

const [all, setAll] = React.useState(firstFrame == null)

const {
canShowMore,
leadingFramesGroupedByFramework,
stackFramesGroupedByFramework,
} = React.useMemo(() => {
const leadingFrames = allLeadingFrames.filter((f) => f.expanded || all)
const visibleCallStackFrames = allCallStackFrames.filter(
(f) => f.expanded || all
)

return {
canShowMore:
allCallStackFrames.length !== visibleCallStackFrames.length ||
(all && firstFrame != null),

stackFramesGroupedByFramework:
groupStackFramesByFramework(allCallStackFrames),

leadingFramesGroupedByFramework:
groupStackFramesByFramework(leadingFrames),
}
}, [all, allCallStackFrames, allLeadingFrames, firstFrame])
const { leadingFramesGroupedByFramework, stackFramesGroupedByFramework } =
React.useMemo(() => {
const leadingFrames = allLeadingFrames.filter((f) => f.expanded)

return {
stackFramesGroupedByFramework:
groupStackFramesByFramework(allCallStackFrames),

leadingFramesGroupedByFramework:
groupStackFramesByFramework(leadingFrames),
}
}, [allCallStackFrames, allLeadingFrames])

return (
<React.Fragment>
Expand All @@ -82,32 +70,11 @@ export function RuntimeError({ error }: RuntimeErrorProps) {
/>
</React.Fragment>
) : undefined}
{canShowMore ? (
<React.Fragment>
<button
tabIndex={10}
data-nextjs-data-runtime-error-collapsed-action
type="button"
onClick={() => setAll(!all)}
>
{all ? 'Hide' : 'Show'} collapsed frames
</button>
</React.Fragment>
) : undefined}
</React.Fragment>
)
}

export const styles = css`
button[data-nextjs-data-runtime-error-collapsed-action] {
background: none;
border: none;
padding: 0;
font-size: var(--size-font-small);
line-height: var(--size-font-bigger);
color: var(--color-accents-3);
}
[data-nextjs-call-stack-frame]:not(:last-child),
[data-nextjs-component-stack-frame]:not(:last-child) {
margin-bottom: var(--size-gap-double);
Expand Down

0 comments on commit e5da0a0

Please sign in to comment.