v9.0.3
This bugfix release drops the ReactDOM / React Native specific use of render batching, as React 18 now automatically batches, and updates the React types dependencies
Changelog
Batching Dependency Updates
React-Redux has long depended on React's unstable_batchedUpdates
API to help batch renders queued by Redux updates. It also re-exported that method as a util named batch
.
However, React 18 now auto-batches all queued renders in the same event loop tick, so unstable_batchedUpdates
is effectively a no-op.
Using unstable_batchedUpdates
has always been a pain point, because it's exported by the renderer package (ReactDOM or React Native), rather than the core react
package. Our prior implementation relied on having separate batch.ts
and batch.native.ts
files in the codebase, and expecting React Native's bundler to find the right transpiled file at app build time. Now that we're pre-bundling artifacts in React-Redux v9, that approach has become a problem.
Given that React 18 already batches by default, there's no further need to continue using unstable_batchedUpdates
internally, so we've removed our use of that and simplified the internals.
We still export a batch
method, but it's effectively a no-op that just immediately runs the given callback, and we've marked it as @deprecated
.
We've also updated the build artifacts and packaging, as there's no longer a need for an alternate-renderers
entry point that omits batching, or a separate artifact that imports from "react-native"
.
What's Changed
- Drop renderer-specific batching behavior and deprecate
batch
by @markerikson in #2104 - Drop
@types/react-dom
and lower@types/react
to min needed by @markerikson in #2105
Full Changelog: v9.0.2...v9.0.3