We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
react changelog
Hey there, React fans! 🎉 We've got some exciting updates that are sure to make your hydration processes smoother than ever. Let's dive into what's new:
-
New Feature: Hydration Lanes in Action 🚀
We've revamped how hydration work is scheduled by using Hydration Lanes instead of raw update lanes. This means no more random hydration mixing with other updates! Now, when you initiate root hydration or useunstable_scheduleHydration
, it's all handled through the right lanes. This change prevents unnecessary client rendering during hydration, ensuring a smoother and more efficient process. -
Bugfix: No More Unwanted Client Rendering 🐛
Updating a root while it's still hydrating used to cause some hiccups, like triggering client rendering when it wasn't needed. With our new approach, updates apply after hydration, sidestepping any potential mix-ups and keeping things running like a well-oiled machine. -
Performance Boost: Streamlined Hydration and Updates ⚡
We've tackled potential performance issues by ensuring thatunstable_scheduleHydration
doesn't get tangled with updates that might force a rewind. Now, hydration starts cleanly without unnecessary updates, making your app snappier and more reliable. -
Safety First: Feature Flag Added 🔒
We've introduced a kill switch,enableHydrationLaneScheduling
, for those who love to experiment but want a safety net. It's all about giving you control while keeping things safe, especially since these scenarios are pretty rare.
With these improvements, your React apps are set to hydrate like never before. Happy coding! 🌟
Included Commits
This commit introduces a significant improvement in the scheduling of hydration work within the React framework by utilizing Hydration Lanes instead of raw update lanes when initiating root hydration and using the unstable_scheduleHydration
function. The primary goal is to prevent the mixing of hydration tasks with other types of updates, which can lead to unnecessary client rendering during hydration. By ensuring that hydration processes are handled exclusively through appropriate lanes, the commit resolves issues where updates could inadvertently trigger client rendering while the root is still in the hydration phase.
Additionally, the commit addresses potential performance concerns by streamlining how hydration and updates are processed. It adds a new feature flag, enableHydrationLaneScheduling
, to allow for controlled experimentation with this new scheduling approach, although it is deemed safe given the infrequent use of unstable_scheduleHydration
. The changes include modifications to several files, enhancing the scheduling logic and providing test cases to verify that updates occurring at the same priority as initial hydration do not cause client renders. Overall, this update aims to improve the efficiency and reliability of hydration in React applications.
Files changed
- packages/react-dom/src/__tests__/ReactDOMFizzShellHydration-test.js
- packages/react-reconciler/src/ReactFiberLane.js
- packages/react-reconciler/src/ReactFiberReconciler.js
- packages/shared/ReactFeatureFlags.js
- packages/shared/forks/ReactFeatureFlags.native-fb.js
- packages/shared/forks/ReactFeatureFlags.native-oss.js
- packages/shared/forks/ReactFeatureFlags.test-renderer.js
- packages/shared/forks/ReactFeatureFlags.test-renderer.native-fb.js
- packages/shared/forks/ReactFeatureFlags.test-renderer.www.js
- packages/shared/forks/ReactFeatureFlags.www.js