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

fix: use latest experimental method names #12669

Merged
merged 1 commit into from May 10, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/next/client/index.js
Expand Up @@ -371,8 +371,8 @@ function renderReactElement(reactEl, domEl) {
const opts = { hydrate: true }
reactRoot =
process.env.__NEXT_REACT_MODE === 'concurrent'
? ReactDOM.createRoot(domEl, opts)
: ReactDOM.createBlockingRoot(domEl, opts)
? ReactDOM.unstable_createRoot(domEl, opts)
Copy link

Choose a reason for hiding this comment

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

Won't this break on versions before 33c3af284? I'm not sure it is worth it, but what about:

const createRoot = ReactDOM.unstable_createRoot ? ReactDOM.unstable_createRoot : ReactDOM.createRoot
const createBlockingRoot = ReactDOM.unstable_createBlockingRoot ? ReactDOM.unstable_createBlockingRoot : ReactDOM.createBlockingRoot

reactRoot = process.env.__NEXT_REACT_MODE === 'concurrent' ? createRoot : createBlockingRoot

Copy link
Member Author

Choose a reason for hiding this comment

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

Won't this break on versions before 33c3af284?

Yes, which is IMO fine for experimental features. I think maintaining multiple experimental versions is not viable long-term. But that's up to the maintainers.

Choose a reason for hiding this comment

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

👍 just thought I'd ask =)

Copy link
Member

Choose a reason for hiding this comment

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

Yep we should just update it 👍

: ReactDOM.unstable_createBlockingRoot(domEl, opts)
}
reactRoot.render(reactEl)
} else {
Expand Down