Skip to content

Don’t render <Portal>s while hydrating#3825

Merged
thecrypticace merged 2 commits into
mainfrom
fix/issue-3824
Dec 4, 2025
Merged

Don’t render <Portal>s while hydrating#3825
thecrypticace merged 2 commits into
mainfrom
fix/issue-3824

Conversation

@thecrypticace
Copy link
Copy Markdown
Contributor

We're currently rendering the portal target element when hydrating. This breaks SSR when using portals. We need to not render portals during hydration since portals (even the wrapper target) are not renderable on the server.

Fixes #3824

cc @RobinMalfait

@vercel
Copy link
Copy Markdown

vercel Bot commented Dec 3, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
headlessui-react Ready Ready Preview Comment Dec 3, 2025 11:16pm
headlessui-vue Ready Ready Preview Comment Dec 3, 2025 11:16pm

@thecrypticace thecrypticace changed the title React: Don’t render portal while hydrating Don’t render <Portal>s while hydrating Dec 3, 2025
Copy link
Copy Markdown
Member

@RobinMalfait RobinMalfait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this was indeed broken by PR #3789 but the issue #3681 it solved still works here as well!

Image

@thecrypticace
Copy link
Copy Markdown
Contributor Author

Fantastic — thanks for checking

@thecrypticace thecrypticace merged commit 7baca70 into main Dec 4, 2025
8 checks passed
@thecrypticace thecrypticace deleted the fix/issue-3824 branch December 4, 2025 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

React hydration error for Portal elements

2 participants