Skip to content

[Beta] Hydrate with startTransition #5040

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions beta/patches/next+12.1.7-canary.11.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
diff --git a/node_modules/next/dist/client/index.js b/node_modules/next/dist/client/index.js
index 8541301..f4c8dd7 100644
--- a/node_modules/next/dist/client/index.js
+++ b/node_modules/next/dist/client/index.js
@@ -480,7 +480,10 @@ function renderReactElement(domEl, fn) {
if (process.env.__NEXT_REACT_ROOT) {
if (!reactRoot) {
// Unlike with createRoot, you don't need a separate root.render() call here
- reactRoot = ReactDOM.hydrateRoot(domEl, reactEl);
+ const startTransition = _react.default.startTransition;
+ startTransition(()=>{
+ reactRoot = ReactDOM.hydrateRoot(domEl, reactEl);
+ });
// TODO: Remove shouldHydrate variable when React 18 is stable as it can depend on `reactRoot` existing
shouldHydrate = false;
} else {