Server render the nearest not-found boundary - #98583
Open
AdzerKI wants to merge 1 commit into
Open
Conversation
notFound() answers with the empty error shell: React's streaming SSR does not run client error boundaries, so the not-found markup and the layouts around it are drawn by the client only. Crawlers and the first frame get an empty body, and a blocking script in the root layout never runs. The error payload now builds the nearest not-found boundary inside its layouts with the same subtree builder as a matched path, and falls back to the shell when the route declares none or the build fails.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #62228.
notFound()answers with the empty error shell. React's streaming SSR does not run client error boundaries, soHTTPAccessFallbackBoundarynever produces markup on the server: the not-found page and the layouts around it are drawn by the client only. Crawlers and the first frame get an empty body, and a blocking script in the root layout never runs.The error payload now builds the nearest not-found boundary inside its layouts with
createFullComponentTree— the subtree builder of a matched path — and keeps the shell when the route declares no boundary or the build fails.global-not-foundkeeps its own tree.Server HTML now matches what the client renders: the root boundary for a root-level
notFound(), the nested one for a nested route. Covered by a new assertion innot-found/basicon the fetched markup; the 16 not-found and global-not-found e2e suites pass.