You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you call hydrateRoot with (container, options), so forgetting <App /> and then call root.render():
constroot=hydrateRoot(container,/* missing react element /*{onUncaughtError: (error)=>{console.error(error);}});root.render();
Result
We show this error:
This root received an early update, before anything was able hydrate. Switched the entire root to client rendering.
This is common to do when switching from createRoot to hydrateRoot.
Expected
If you don't call root.render(), you see the real error:
Objects are not valid as a React child (found: object with keys {onUncaughtError}). If you meant to render a collection of children, use an array instead.
But we should match the options validation error from createRoot:
Warning: You passed a second argument to root.render(…) but it only accepts one argument.
With an error like:
Warning: You passed an options object as the second argument to `hydrateRoot(...)`, did you forget to pass a React element?
Versions
React version: 18.2.0 - 19.0.0-canary
The text was updated successfully, but these errors were encountered:
rickhanlonii
changed the title
Bug: Invalid options to hydrateRoot shows error ""
Bug: Invalid options to hydrateRoot can error with "This root received an early update"
Apr 9, 2024
Overview
https://codesandbox.io/s/5ch3lc
If you call
hydrateRoot
with (container, options), so forgetting<App />
and then callroot.render()
:Result
We show this error:
This root received an early update, before anything was able hydrate. Switched the entire root to client rendering.
This is common to do when switching from
createRoot
tohydrateRoot
.Expected
If you don't call
root.render()
, you see the real error:Objects are not valid as a React child (found: object with keys {onUncaughtError}). If you meant to render a collection of children, use an array instead.
But we should match the options validation error from
createRoot
:Warning: You passed a second argument to root.render(…) but it only accepts one argument.
With an error like:
Warning: You passed an options object as the second argument to `hydrateRoot(...)`, did you forget to pass a React element?
Versions
React version: 18.2.0 - 19.0.0-canary
The text was updated successfully, but these errors were encountered: