This release shrinks the size of our internal Subscription
class, and updates useSelector
to avoid an unnecessary selector call on mount.
Changes
Subscription Size Refactor
Our internal Subscription
implementation has been written as a class ever since it was added in v5. By rewriting it as a closure factory, we were able to shave a few bytes off the final bundle size.
useSelector
Mount Optimization
A user noticed that useSelector
had never been given an early "bail out if the root state is the same" check to match how connect
works. This resulted in a usually-unnecessary second call to the provided selector on mount. We've added that check.
Entry Point Consolidation
We've consolidated the list of exported public APIs into a single file, and both the index.js
and alternate-renderers.js
entry points now re-export everything from that file. No meaningful change here, just shuffling lines of code around for consistency.
Other Updates
React-Redux v8 and React 18 Development
With the announcement of React 18, we've been working with the React team to plan our migration path to keep React-Redux fully compatible with React's upcoming features.
We've already migrated the React-Redux main development branch to TypeScript, and are prototyping compatibility implementation updates. We'd appreciate any assistance from the community in testing out these changes so that we can ensure React-Redux works great for everyone when React 18 is ready!
Internal Tooling Updates
Our master
branch now uses Yarn v2 for package management, is built with TypeScript, and we've made CI updates to test against multiple TS versions.
The 7.x
branch has also been updated to use Yarn v2 for consistency.
These only affect contributors to the React-Redux package itself.
Changelog
- Port entry point consolidation from 8.x branch (#1811 - @markerikson)
- Update v7 branch to use Yarn v2 and improve CI process (#1810 - @markerikson)
- Reduce unnecessary calls to useSelector selector (#1803 - @sufian-slack )
- Port Subscription closure implementation from 8.x to 7.x (#1809 - @mbelsky)