-
Notifications
You must be signed in to change notification settings - Fork 29k
Support new hydrate API in latest react 18 alpha release #26664
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
9704163
fix: react 18 new hydration API
huozhi 85db7d6
support react 18
huozhi bcffc83
compat latest react only, fix resolved version
huozhi c920437
fix tests
huozhi 8d741a7
Some changes based on https://github.com/reactwg/react-18/discussions/5
timneutkens f8cb2fc
Merge branch 'canary' into react18-hydrate
kodiakhq[bot] 213d155
fix test
huozhi 6cd4141
Merge branch 'canary' into react18-hydrate
kodiakhq[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -115,7 +115,9 @@ | |
"pretty-bytes": "5.3.0", | ||
"pretty-ms": "7.0.0", | ||
"react": "17.0.2", | ||
"react-18": "npm:[email protected]", | ||
"react-dom": "17.0.2", | ||
"react-dom-18": "npm:[email protected]", | ||
"react-ssr-prepass": "1.0.8", | ||
"release": "6.3.0", | ||
"request-promise-core": "1.1.2", | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module.exports = { | ||
webpack(config) { | ||
const { alias } = config.resolve | ||
// FIXME: resolving react/jsx-runtime https://github.com/facebook/react/issues/20235 | ||
alias['react/jsx-dev-runtime'] = require.resolve('react/jsx-dev-runtime.js') | ||
alias['react/jsx-runtime'] = require.resolve('react/jsx-runtime.js') | ||
|
||
// Use react 18 | ||
alias['react'] = require.resolve('react-18') | ||
alias['react-dom'] = require.resolve('react-dom-18') | ||
|
||
return config | ||
}, | ||
} |
1 change: 0 additions & 1 deletion
1
test/integration/react-18/prerelease/node_modules/react-dom/index.js
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
test/integration/react-18/prerelease/node_modules/react-dom/package.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
{ | ||
"dependencies": { | ||
"react": "*", | ||
"react-dom": "*" | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
export default function Index() { | ||
if (typeof window !== 'undefined') { | ||
window.didHydrate = true | ||
} | ||
return <p>Hello</p> | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15632,6 +15632,23 @@ rc@^1.0.1, rc@^1.1.6, rc@^1.2.7, rc@^1.2.8: | |
minimist "^1.2.0" | ||
strip-json-comments "~2.0.1" | ||
|
||
"react-18@npm:[email protected]": | ||
version "18.0.0-alpha-e6be2d531" | ||
resolved "https://registry.yarnpkg.com/react/-/react-18.0.0-alpha-e6be2d531.tgz#c5cf6d5706f7b6411d36848b483a7937c94fc5c9" | ||
integrity sha512-roZmm4MYfuGN65PiagPvhumBb3Da1FAgyj6Ti2sHwQDIxhi40PMq5V90gBSKXl7qXbaXHrtpuAtG5R+XkqpDYA== | ||
dependencies: | ||
loose-envify "^1.1.0" | ||
object-assign "^4.1.1" | ||
|
||
"react-dom-18@npm:[email protected]": | ||
version "18.0.0-alpha-e6be2d531" | ||
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-18.0.0-alpha-e6be2d531.tgz#89b1aef488a56ceac7cc0169ae02d7fbb58cbbb6" | ||
integrity sha512-mMGiX/kyhxaUTRDt+Q5oIbpU6cPvO8Sp/kHz3cdNFviwVTHHF2YrnnD70BD2F1R0b7wAdfVVit9EfE+Rqt0sJA== | ||
dependencies: | ||
loose-envify "^1.1.0" | ||
object-assign "^4.1.1" | ||
scheduler "0.21.0-alpha-e6be2d531" | ||
|
||
[email protected]: | ||
version "17.0.2" | ||
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-17.0.2.tgz#ecffb6845e3ad8dbfcdc498f0d0a939736502c23" | ||
|
@@ -16649,6 +16666,14 @@ saxes@^5.0.1: | |
dependencies: | ||
xmlchars "^2.2.0" | ||
|
||
[email protected]: | ||
version "0.21.0-alpha-e6be2d531" | ||
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.21.0-alpha-e6be2d531.tgz#fd895f7426e15166f1b16ed1d54de48243c78002" | ||
integrity sha512-1GSnBp3em+oMz93ncjqR/7qeGArhgKaOWluZUrQW2JgHEGYISXAhGTVQhUYAiKc3F9jiq94CE1WrO0vaVzgReQ== | ||
dependencies: | ||
loose-envify "^1.1.0" | ||
object-assign "^4.1.1" | ||
|
||
scheduler@^0.20.2: | ||
version "0.20.2" | ||
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.20.2.tgz#4baee39436e34aa93b4874bddcbf0fe8b8b50e91" | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.