Skip to content
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

Merged
merged 5 commits into from
Jun 14, 2024

Conversation

brophdawg11
Copy link
Contributor

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 a Layout exists.

Instead, if we are inside the default error boundary and the root route has both a Layout and an ErrorBoundary then we must have thrown trying to render the error via the Layout 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

Copy link

changeset-bot bot commented Jun 5, 2024

🦋 Changeset detected

Latest commit: e228701

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 16 packages
Name Type
@remix-run/react Patch
@remix-run/testing Patch
@remix-run/dev Patch
create-remix Patch
remix Patch
@remix-run/architect Patch
@remix-run/cloudflare Patch
@remix-run/cloudflare-pages Patch
@remix-run/cloudflare-workers Patch
@remix-run/css-bundle Patch
@remix-run/deno Patch
@remix-run/eslint-config Patch
@remix-run/express Patch
@remix-run/node Patch
@remix-run/serve Patch
@remix-run/server-runtime Patch

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

@brophdawg11
Copy link
Contributor Author

Note to self - add changeset

@brophdawg11 brophdawg11 merged commit c33a3a2 into dev Jun 14, 2024
5 checks passed
@brophdawg11 brophdawg11 deleted the brophdawg11/error-loop branch June 14, 2024 14:47
@github-actions github-actions bot added the awaiting release This issue has been fixed and will be released soon label Jun 14, 2024
Copy link
Contributor

🤖 Hello there,

We just published version 2.10.0-pre.0 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

Copy link
Contributor

🤖 Hello there,

We just published version 2.10.0 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

@github-actions github-actions bot removed the awaiting release This issue has been fixed and will be released soon label Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Infinite loop on unhandle error using Layout Export with ErrorBoundary
1 participant