Files
Jiachi LiuandGitHub 5fb8378799 [metadata] handle navigation API in streaming metadata (#76156)
### What

When streaming metadata is enabled, the whole metadata result is under
the suspense boundary and will be streamed to client if it takes some
time. Right now we only had the metadata itself rendered under the
suspense boundary. But we also need to deal with the errors, when
there're errors of `notFound()` or `redirect()` it should still be
thrown to trigger the proper error boundary.

One special case needs to be taken care of is when we passing down the
error caught during metadata from RSC layer to client layer, the
`digest` property will be lost as it's not serialized by React now.
Hence we also send both of the error itself and its digest to client and
let client compose them when both present. In this way we can keep the
original error digest of `notFound` and `redirect` navigation errors. We
don't have this case in non-streaming metadata as the metatdata
resolving was all done on the RSC side.

When streaming metadata is disabled, we should not re-throw the errors
on client, let everything works like before in the blocking way.

The metadata re-throw strategy is called `StreamingMetadataOutlet` in
the code, reviewers can focus on that.

Closes NDX-847
2025-02-18 23:00:46 +00:00

13 lines
252 B
TypeScript

export default function Page() {
return <p>index page</p>
}
export async function generateMetadata() {
await new Promise((resolve) => setTimeout(resolve, 1 * 1000))
return {
title: 'index page',
}
}
export const dynamic = 'force-dynamic'