Skip to content

Remove hydrate option from createRoot#22878

Merged
salazarm merged 5 commits into
react:mainfrom
salazarm:removeHydrateOption
Dec 7, 2021
Merged

Remove hydrate option from createRoot#22878
salazarm merged 5 commits into
react:mainfrom
salazarm:removeHydrateOption

Conversation

@salazarm

@salazarm salazarm commented Dec 7, 2021

Copy link
Copy Markdown
Contributor

Summary

Removing hydrate: true and hydrateOptions from createRoot. Instead hydrateRoot should be used.

How did you test this change?

Updated jest tests. There is one useMutableSourceHydration test that I'm unsure about. Added a comment above it.

@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Dec 7, 2021
if (gate(flags => flags.enableSyncDefaultUpdates)) {
expect(Scheduler).toHaveYielded([2, 'a:two']);
} else {
// Not sure about this...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@acdlite Unsure why I needed to do this. Could you enlighten me please? :)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

hydrateRoot is synchronous whereas root.render is not

@sizebot

sizebot commented Dec 7, 2021

Copy link
Copy Markdown

Comparing: c7917fe...7eb0aba

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.min.js = 129.89 kB 129.69 kB = 41.62 kB 41.56 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 134.64 kB 134.44 kB = 43.00 kB 42.93 kB
facebook-www/ReactDOM-prod.classic.js = 428.08 kB 427.76 kB = 78.60 kB 78.55 kB
facebook-www/ReactDOM-prod.modern.js = 416.64 kB 416.32 kB = 76.91 kB 76.86 kB
facebook-www/ReactDOMForked-prod.classic.js = 428.08 kB 427.76 kB = 78.60 kB 78.55 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by 🚫 dangerJS against 7eb0aba

@sebmarkbage

Copy link
Copy Markdown
Contributor

We should probably keep a warning if someone passes it since it was around in early versions a long time.

@salazarm
salazarm merged commit 5041c37 into react:main Dec 7, 2021
@sebmarkbage

Copy link
Copy Markdown
Contributor

Nice. It's like taking a shower. Feels fresh.

facebook-github-bot pushed a commit to react/react-native that referenced this pull request Dec 14, 2021
Summary:
This sync includes the following changes:
- **[f2a59df](react/react@f2a59df48 )**: Remove unstableAvoidThisFallback from OSS ([#22884](react/react#22884)) //<salazarm>//
- **[24dd07b](react/react@24dd07bd2 )**: Add custom element property support behind a flag ([#22184](react/react#22184)) //<Joey Arhar>//
- **[72e48b8](react/react@72e48b8e1 )**: Fix: Don't skip writing updated package.json //<Andrew Clark>//
- **[e39b2c8](react/react@e39b2c899 )**: Fix peer deps for use-sync-external-store //<Andrew Clark>//
- **[ec78b13](react/react@ec78b135f )**: Don't override use-sync-external-store peerDeps ([#22882](react/react#22882)) //<Andrew Clark>//
- **[5041c37](react/react@5041c37d2 )**: Remove hydrate option from createRoot ([#22878](react/react#22878)) //<salazarm>//
- **[3f9480f](react/react@3f9480f0f )**: enable continuous replay flag ([#22863](react/react#22863)) //<salazarm>//
- **[4729ff6](react/react@4729ff6d1 )**: Implement identifierPrefix option for useId ([#22855](react/react#22855)) //<Andrew Clark>//
- **[ed00d2c](react/react@ed00d2c3d )**: Remove unused flag ([#22854](react/react#22854)) //<Dan Abramov>//
- **[0cc724c](react/react@0cc724c77 )**: update ReactFlightWebpackPlugin to be compatiable with webpack v5 ([#22739](react/react#22739)) //<Michelle Chen>//
- **[4e6eec6](react/react@4e6eec69b )**: fix: document can be `null`, not just `undefined` ([#22695](react/react#22695)) //<Simen Bekkhus>//

Changelog:
[General][Changed] - React Native sync for revisions c1220eb...a049aa0

jest_e2e[run_all_tests]

Reviewed By: rickhanlonii

Differential Revision: D33062386

fbshipit-source-id: 37e497947efad5696c251096da8a92ccdc6dcea7
@salazarm
salazarm deleted the removeHydrateOption branch February 10, 2022 14:27
zhengjitf pushed a commit to zhengjitf/react that referenced this pull request Apr 15, 2022
* remove hydrate: true option

* remove missed comment

* lint

* warning

* circumvent flow
mrizwanashiq pushed a commit to mrizwanashiq/react that referenced this pull request Jun 25, 2026
* remove hydrate: true option

* remove missed comment

* lint

* warning

* circumvent flow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed React Core Team Opened by a member of the React Core Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants