Skip to content

Commit

Permalink
Import hydrateRoot from react-dom/client (#2789)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattgperry authored Sep 4, 2024
1 parent beae985 commit 5619d56
Show file tree
Hide file tree
Showing 27 changed files with 28 additions and 26 deletions.
2 changes: 1 addition & 1 deletion dev/html/public/optimized-appear/defer-handoff-block.html
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
},
(animation) => {
setTimeout(() => {
ReactDOM.hydrateRoot(root, Component)
ReactDOMClient.hydrateRoot(root, Component)
}, (duration * 1000) / 4)
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
},
(animation) => {
setTimeout(() => {
ReactDOM.hydrateRoot(
ReactDOMClient.hydrateRoot(
root,
React.createElement(Component)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
},
(animation) => {
setTimeout(() => {
ReactDOM.hydrateRoot(
ReactDOMClient.hydrateRoot(
root,
React.createElement(Component)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
},
(animation) => {
setTimeout(() => {
ReactDOM.hydrateRoot(
ReactDOMClient.hydrateRoot(
root,
React.createElement(Component)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
},
(animation) => {
setTimeout(() => {
ReactDOM.hydrateRoot(
ReactDOMClient.hydrateRoot(
root,
React.createElement(Component)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
},
(animation) => {
setTimeout(() => {
ReactDOM.hydrateRoot(
ReactDOMClient.hydrateRoot(
root,
React.createElement(Component)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
},
(animation) => {
setTimeout(() => {
ReactDOM.hydrateRoot(
ReactDOMClient.hydrateRoot(
root,
React.createElement(Component)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
},
(animation) => {
setTimeout(() => {
ReactDOM.hydrateRoot(
ReactDOMClient.hydrateRoot(
root,
React.createElement(Component)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
},
(animation) => {
setTimeout(() => {
ReactDOM.hydrateRoot(
ReactDOMClient.hydrateRoot(
root,
React.createElement(Component)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
},
(animation) => {
setTimeout(() => {
ReactDOM.hydrateRoot(
ReactDOMClient.hydrateRoot(
root,
React.createElement(Component)
)
Expand Down
2 changes: 1 addition & 1 deletion dev/html/public/optimized-appear/defer-handoff-layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
},
(animation) => {
setTimeout(() => {
ReactDOM.hydrateRoot(
ReactDOMClient.hydrateRoot(
root,
React.createElement(Component)
)
Expand Down
2 changes: 1 addition & 1 deletion dev/html/public/optimized-appear/defer-handoff.html
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
},
(animation) => {
setTimeout(() => {
ReactDOM.hydrateRoot(root, Component)
ReactDOMClient.hydrateRoot(root, Component)
}, (duration * 1000) / 2)
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
(animation) => {
// Hydrate root mid-way through animation
setTimeout(() => {
ReactDOM.hydrateRoot(root, Component)
ReactDOMClient.hydrateRoot(root, Component)

const { opacity: initialOpacity } =
window.getComputedStyle(box)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
(animation) => {
// Hydrate root mid-way through delay
setTimeout(() => {
ReactDOM.hydrateRoot(root, Component)
ReactDOMClient.hydrateRoot(root, Component)

const { opacity: initialOpacity } =
window.getComputedStyle(box)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
(animation) => {
// Hydrate root mid-way through delay
setTimeout(() => {
ReactDOM.hydrateRoot(root, Component)
ReactDOMClient.hydrateRoot(root, Component)

const { opacity: initialOpacity } =
window.getComputedStyle(box)
Expand Down
2 changes: 1 addition & 1 deletion dev/html/public/optimized-appear/interrupt-spring.html
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
(animation) => {
// Hydrate root mid-way through animation
setTimeout(() => {
ReactDOM.hydrateRoot(root, Component)
ReactDOMClient.hydrateRoot(root, Component)
}, 100)
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
(animation) => {
// Hydrate root mid-way through animation
setTimeout(() => {
ReactDOM.hydrateRoot(root, Component)
ReactDOMClient.hydrateRoot(root, Component)
}, (duration * 1000) / 2)
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
(animation) => {
// Hydrate root mid-way through animation
setTimeout(() => {
ReactDOM.hydrateRoot(root, Component)
ReactDOMClient.hydrateRoot(root, Component)
}, (duration * 1000) / 2)
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
(animation) => {
// Hydrate root mid-way through animation
setTimeout(() => {
ReactDOM.hydrateRoot(root, Component)
ReactDOMClient.hydrateRoot(root, Component)
}, (duration * 1000) / 2)
}
)
Expand Down
2 changes: 1 addition & 1 deletion dev/html/public/optimized-appear/interrupt-tween-x.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
},
(animation) => {
setTimeout(() => {
ReactDOM.hydrateRoot(root, Component)
ReactDOMClient.hydrateRoot(root, Component)
}, (duration * 1000) / 2)
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
},
(animation) => {
setTimeout(() => {
ReactDOM.hydrateRoot(root, Component)
ReactDOMClient.hydrateRoot(root, Component)
}, (duration * 1000) / 2)
}
)
Expand Down
2 changes: 1 addition & 1 deletion dev/html/public/optimized-appear/persist.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
*/
setTimeout(() => {
// Hydrate root mid-way through animation
ReactDOM.hydrateRoot(root, Component)
ReactDOMClient.hydrateRoot(root, Component)
}, duration * 1000 + 1000)
}
)
Expand Down
2 changes: 1 addition & 1 deletion dev/html/public/optimized-appear/portal.html
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
},
})
)
ReactDOM.hydrateRoot(root, Component)
ReactDOMClient.hydrateRoot(root, Component)
}, (duration * 1000) / 2)
}
)
Expand Down
2 changes: 1 addition & 1 deletion dev/html/public/optimized-appear/resync-delay.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
options,
(animation) => {
setTimeout(() => {
ReactDOM.hydrateRoot(root, Component)
ReactDOMClient.hydrateRoot(root, Component)
}, duration * 1000)
}
)
Expand Down
2 changes: 1 addition & 1 deletion dev/html/public/optimized-appear/resync.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
},
() => {
setTimeout(() => {
ReactDOM.hydrateRoot(root, Component)
ReactDOMClient.hydrateRoot(root, Component)
}, (duration * 1000) / 2)
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
// Emulate server rendering of element
root.innerHTML = ReactDOMServer.renderToString(Component)

ReactDOM.hydrateRoot(root, Component)
ReactDOMClient.hydrateRoot(root, Component)
</script>
</body>
</html>
2 changes: 2 additions & 0 deletions dev/html/src/imports/optimized-appear.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import * as React from "react"
import * as ReactDOM from "react-dom"
import * as ReactDOMClient from "react-dom/client"
import * as ReactDOMServer from "react-dom/server"
import * as Motion from "framer-motion"

window.React = React
window.ReactDOM = ReactDOM
window.ReactDOMClient = ReactDOMClient
window.ReactDOMServer = ReactDOMServer
window.Motion = Motion

0 comments on commit 5619d56

Please sign in to comment.