This beta release updates the build step to extract error messages and optimizes internal imports in RTK Query for smaller production bundle sizes, adds a selectCachedArgsForQuery
util, and includes all changes in v1.9.6
npm i @reduxjs/toolkit@beta
yarn add @reduxjs/toolkit@beta
The 2.0 integration branch contains the docs preview for the 2.0 changes. Not all changes are documented yet, but you can see API reference pages for most of the new features here:
Changelog
Bundle Size Optimizations
Redux 4.1.0 optimized its bundle size by extracting error message strings out of production builds, based on React's approach. We've applied the same technique to RTK. This saves about 1000 bytes from prod bundles (actual benefits will depend on which imports are being used).
We also noted that ESBuild does not deduplicate imports when it bundles source files, and this was causing RTK Query's bundle to contain a dozen references to import { } from "@reduxjs/toolkit"
, including some of the same methods. Manually deduplicating those saves about 600 bytes off the production RTKQ artifact.
Other Changes
We've added a selectCachedArgsForQuery
util selector that will return the saved arguments that were used for a given cache entry.
This also includes all of the changes in v1.9.6
.
What's Changed
- Switch advised syntax for create.reducer by @EskiMojo14 in #3702
- Add selectCachedArgsForQuery util by @EskiMojo14 in #3547
- Optimize bundles for RTK 2.0 by @markerikson in #3740
- Merge
1.9.6
intov2.0-integration
by @markerikson in #3743
Full Changelog: v2.0.0-beta.1...v2.0.0-beta.2