yarn @reduxjs/toolkit 2.0.0-beta.2
v2.0.0-beta.2

latest releases: 2.3.0, 2.2.8, 2.2.7...
14 months ago

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

Full Changelog: v2.0.0-beta.1...v2.0.0-beta.2

Don't miss a new toolkit release

NewReleases is sending notifications on new releases.