Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the bottom collapse button in dev overlay #71658

Merged
merged 2 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
24 changes: 0 additions & 24 deletions test/development/acceptance-app/ReactRefreshLogBox.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -803,12 +803,6 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
expect(source).toContain('app/page.js')
expect(source).toContain(`throw new Error('Client error')`)

await expect(
browser.hasElementByCssSelector(
'[data-nextjs-data-runtime-error-collapsed-action]'
)
).resolves.toEqual(false)

const stackFrameElements = await browser.elementsByCss(
'[data-nextjs-call-stack-frame]'
)
Expand Down Expand Up @@ -844,12 +838,6 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
expect(source).toContain('app/page.js')
expect(source).toContain(`throw new Error('Server error')`)

await expect(
browser.hasElementByCssSelector(
'[data-nextjs-data-runtime-error-collapsed-action]'
)
).resolves.toEqual(false)

const stackFrameElements = await browser.elementsByCss(
'[data-nextjs-call-stack-frame]'
)
Expand Down Expand Up @@ -893,12 +881,6 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
`throw new Error("This is an error from an anonymous function")`
)

await expect(
browser.hasElementByCssSelector(
'[data-nextjs-data-runtime-error-collapsed-action]'
)
).resolves.toEqual(false)

const stackFrameElements = await browser.elementsByCss(
'[data-nextjs-call-stack-frame]'
)
Expand Down Expand Up @@ -963,12 +945,6 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
expect(source).toContain('app/page.js')
expect(source).toContain(`new URL("/", "invalid")`)

await expect(
browser.hasElementByCssSelector(
'[data-nextjs-data-runtime-error-collapsed-action]'
)
).resolves.toEqual(false)

const stackFrameElements = await browser.elementsByCss(
'[data-nextjs-call-stack-frame]'
)
Expand Down
Loading