github reduxjs/redux-toolkit v1.8.0-rc.0

latest releases: v2.2.5, v2.2.4, v2.2.3...
pre-release2 years ago

This preview release adds the new "listener" middleware, and updates configureStore's types to better handle type inference from middleware that override dispatch return values.

The full 1.8.0 release will be out shortly (within the next couple days), and this RC is primarily for some final compatibility checking. The final release will have a longer changelog description, with examples.

Changelog

New "Listener" Middleware

We've been working on a new "listener" middleware, which lets you trigger callback functions when specific actions are dispatched or state is changed.

After iterating on the middleware's API in its own temporary package, it's now ready for actual release as part of RTK.

The preview API reference is available at:

https://deploy-preview-2024--redux-starter-kit-docs.netlify.app/api/createListenerMiddleware

configureStore Middleware Type Improvements

Middleware can override the default return value of dispatch. configureStore tries to extract any declared dispatch type overrides from the middleware array, and uses that to alter the type of store.dispatch.

We identified some cases where the type inference wasn't working well enough, and rewrote the type behavior to be more correct.

TypeScript Support Matrix Updates

RTK now requires TS 4.1 or greater to work correctly, and we've dropped 4.0 and earlier from our support matrix.

What's Changed

  • Rewrite MiddlewareArray and gDM for better Dispatch inference by @markerikson in #2001
  • Change listener middleware API name and signature by @markerikson in #2005
  • feat(alm): add cancellation message to TaskAbortError, listenerApi.signal & forkApi.signal. by @FaberVitale in #2023
  • [fix][1.8.0-integration][alm]: missing type export by @FaberVitale in #2026
  • [chore][1.8.0-integration][alm]: apply alm breaking API changes to counter-example by @FaberVitale in #2025
  • fix(alm): prevent zombie listeners caused by forked tasks by @FaberVitale in #2070
  • Integrate the listener middleware into the RTK package by @markerikson in #2072
  • fix(alm): cancel forkApi.delay and forkApi.pause if listener is cancelled or completed by @markerikson in #2074

Full Changelog: v1.7.2...v1.8.0-rc.0

Don't miss a new redux-toolkit release

NewReleases is sending notifications on new releases.