Skip to content

Commit

Permalink
add element validation and remove unused boundaries
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi committed Nov 18, 2024
1 parent 6b804cf commit 35e1233
Showing 1 changed file with 11 additions and 22 deletions.
33 changes: 11 additions & 22 deletions packages/next/src/server/app-render/create-component-tree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,17 @@ async function createComponentTreeInternal({
if (typeof NotFound !== 'undefined' && !isValidElementType(NotFound)) {
errorMissingDefaultExport(pagePath, 'not-found')
}

if (typeof Forbidden !== 'undefined' && !isValidElementType(Forbidden)) {
errorMissingDefaultExport(pagePath, 'forbidden')
}

if (
typeof Unauthorized !== 'undefined' &&
!isValidElementType(Unauthorized)
) {
errorMissingDefaultExport(pagePath, 'unauthorized')
}
}

// Handle dynamic segment params.
Expand Down Expand Up @@ -798,28 +809,6 @@ async function createComponentTreeInternal({
</>
) : undefined
}
forbidden={
Forbidden ? (
<>
{layerAssets}
<SegmentComponent params={params}>
{forbiddenStyles}
<Forbidden />
</SegmentComponent>
</>
) : undefined
}
unauthorized={
Unauthorized ? (
<>
{layerAssets}
<SegmentComponent params={params}>
{unauthorizedStyles}
<Unauthorized />
</SegmentComponent>
</>
) : undefined
}
>
{layerAssets}
{serverSegment}
Expand Down

0 comments on commit 35e1233

Please sign in to comment.