Skip to content

Commit

Permalink
fix(WIP): top-level error results in no Component
Browse files Browse the repository at this point in the history
  • Loading branch information
tills13 committed Feb 7, 2024
1 parent 2fa566d commit f34ac34
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/next/src/client/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,12 @@ async function render(renderingProps: RenderRouteInfo): Promise<void> {
// skip re-rendering the error page client-side as data-fetching operations
// will already have been done on the server and NEXT_DATA contains the correct
// data for straight-forward hydration of the error page
if (renderingProps.err && !renderingProps.isHydratePass) {
if (
renderingProps.err &&
// renderingProps.Component might be undefined if there is a top/module-level error
(typeof renderingProps.Component === 'undefined' ||
!renderingProps.isHydratePass)
) {
await renderError(renderingProps)
return
}
Expand Down

0 comments on commit f34ac34

Please sign in to comment.