npm @reduxjs/toolkit 1.3.1
v1.3.1

latest releases: 2.3.0, 2.2.8, 2.2.7...
4 years ago

This release adds additional argument types for some createEntityAdapter CRUD methods.

Changes

createEntityAdapter Insertion APIs

createEntityAdapter generates three methods that can insert entity objects: setAll, addMany, and upsertMany. All three of them accept an array of entities.

We expect that a common use case will be to pre-normalize an API response using normalizr, put the parsed entities into an action, and then handle action.payload.articles in a reducer. However, in that case, action.payload.articles is a pre-normalized object, not an array. While you could do articlesAdapter.addMany(state, Object.values(action.payload.articles)), we decided to make those three methods accept a normalized object in addition to an array, allowing articlesAdapter.addMany(state, action.payload.articles) to work correctly.

createEntityAdapter Usage Guide Docs

We've also added usage guide examples for createEntityAdapter as well.

Changelog

v1.3.0...v1.3.1

Don't miss a new toolkit release

NewReleases is sending notifications on new releases.