-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid hydration loops when layout error renders also throw #9566
Conversation
🦋 Changeset detectedLatest commit: e228701 The changes in this PR will be included in the next version bump. This PR includes changesets to release 16 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Note to self - add changeset |
🤖 Hello there, We just published version Thanks! |
🤖 Hello there, We just published version Thanks! |
If you have a root
Layout
we will try to render that on the success and error flows. If the error flow also throws during hydration (i.e., from a delayed resolved promise render) and we bubble to our default error boundary, then we can get into an infinite loop because we choose not to render the surrounding<html>
in the error boundary when aLayout
exists.Instead, if we are inside the default error boundary and the root route has both a
Layout
and anErrorBoundary
then we must have thrown trying to render the error via theLayout
and we should render the default<html>
shell. Otherwise we get into a react hydration loop because the DOM rejects when we try to add our default error boundary children (h1
,pre
) as children of#document
.Closes #9553