v5.0.0-alpha.2
Pre-releaseThis is an alpha release for Redux 5.0. This release has types changes, an internal implementation tweak, and many changes to our build and test setup.
Changelog
Store Enhancer TS Types Changes
The TS conversion in 2019 had made some changes to the definition of the StoreEnhancer
TS type around replacing reducers. Some time later, we concluded that the enhancer types changes needed to be reverted, but that fell by the wayside. We've finally merged that reversion. This earlier type was never actually released publicly.
We also made an additional change to improve the typing of the next
arg in enhancers.
Internal Listener Implementation
The Redux store has always used an array to track listener callbacks, and used listeners.findIndex
to remove listeners on unsubscribe. As we found in React-Redux, that can have perf issues when many listeners are unsubscribing at once.
In React-Redux, we fixed that with a more sophisticated linked list approach. Here, we've updated the listeners
to be stored in a Map
instead, which has better delete performance than an array.
In practice this shouldn't have any real effect, because React-Redux sets up a subscription in <Provider>
, and all nested components subscribe to that. But, nice to fix it here as well.
Build Tooling Updates
We made numerous updates to our build tooling, including switching package management to Yarn 3, running tests directly from src
locally instead of building first, actually running the TS typetests we'd added years ago, testing our types against a matrix of TS versions, and running tests in CI against a built copy of the library.
What's Changed
- Replace listeners array with a Map for better performance by @markerikson in #4476
- Revert adding the store as a return type to replaceReducer by @Methuselah96 in #3772
- Run tests from source instead of building first by @markerikson in #4483
- Fix type of next parameter in StoreEnhancer type by @Methuselah96 in #3776
- Enable strict mode for TypeScript tests by @Methuselah96 in #4484
- Convert repo to use Yarn 3 for package management by @markerikson in #4485
Full Changelog: v5.0.0-alpha.1...v5.0.0-alpha.2