Skip to content

Commit

Permalink
[DevOverlay] Remove temporary header children (#74490)
Browse files Browse the repository at this point in the history
### Why?

The header children were temporary because they will affect the test utils in the future, we need to change these query selectors from `data-nextjs-dialog-header` to `data-nextjs-dialog-body`:

https://github.com/vercel/next.js/blob/bca0bc921bd81f25e6d8f83d676774724a007bfa/test/lib/next-test-utils.ts#L983-L986

This is not a severe blocker, and we may follow up on this during the QA period when we enable CI tests for the new UI.
We may even have to unify the target attributes for testing before the change.
  • Loading branch information
devjiwonchoi authored Jan 3, 2025
1 parent 1355dfa commit a07559f
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ type ErrorOverlayLayoutProps = {
debugInfo?: DebugInfo
isBuildError?: boolean
onClose?: () => void
// TODO: remove this
temporaryHeaderChildren?: React.ReactNode
versionInfo?: VersionInfo
// TODO: better handle receiving
readyErrors?: ReadyRuntimeError[]
Expand All @@ -47,7 +45,6 @@ export function ErrorOverlayLayout({
debugInfo,
isBuildError,
onClose,
temporaryHeaderChildren,
versionInfo,
readyErrors,
activeIdx,
Expand Down Expand Up @@ -90,7 +87,6 @@ export function ErrorOverlayLayout({
>
{errorMessage}
</p>
{temporaryHeaderChildren}
</DialogHeader>
<DialogBody className="nextjs-container-errors-body">
{children}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,50 +263,46 @@ export function Errors({
readyErrors={readyErrors}
activeIdx={activeIdx}
setActiveIndex={setActiveIndex}
temporaryHeaderChildren={
>
{notes ? (
<>
{notes ? (
<>
<p
id="nextjs__container_errors__notes"
className="nextjs__container_errors__notes"
>
{notes}
</p>
</>
) : null}
{hydrationWarning ? (
<p
id="nextjs__container_errors__link"
className="nextjs__container_errors__link"
>
<HotlinkedText text="See more info here: https://nextjs.org/docs/messages/react-hydration-error" />
</p>
) : null}

{hydrationWarning &&
(activeError.componentStackFrames?.length ||
!!errorDetails.reactOutputComponentDiff) ? (
<PseudoHtmlDiff
className="nextjs__container_errors__component-stack"
hydrationMismatchType={hydrationErrorType}
componentStackFrames={activeError.componentStackFrames || []}
firstContent={serverContent}
secondContent={clientContent}
reactOutputComponentDiff={errorDetails.reactOutputComponentDiff}
/>
) : null}
{isServerError ? (
<div>
<small>
This error happened while generating the page. Any console logs
will be displayed in the terminal window.
</small>
</div>
) : undefined}
<p
id="nextjs__container_errors__notes"
className="nextjs__container_errors__notes"
>
{notes}
</p>
</>
}
>
) : null}
{hydrationWarning ? (
<p
id="nextjs__container_errors__link"
className="nextjs__container_errors__link"
>
<HotlinkedText text="See more info here: https://nextjs.org/docs/messages/react-hydration-error" />
</p>
) : null}

{hydrationWarning &&
(activeError.componentStackFrames?.length ||
!!errorDetails.reactOutputComponentDiff) ? (
<PseudoHtmlDiff
className="nextjs__container_errors__component-stack"
hydrationMismatchType={hydrationErrorType}
componentStackFrames={activeError.componentStackFrames || []}
firstContent={serverContent}
secondContent={clientContent}
reactOutputComponentDiff={errorDetails.reactOutputComponentDiff}
/>
) : null}
{isServerError ? (
<div>
<small>
This error happened while generating the page. Any console logs will
be displayed in the terminal window.
</small>
</div>
) : undefined}
<RuntimeError key={activeError.id.toString()} error={activeError} />
</ErrorOverlayLayout>
)
Expand Down

0 comments on commit a07559f

Please sign in to comment.