v1.3.1
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
- Add basic createEntityAdapter usage docs (@msutkowski - #442)
- Add dictionary support to createEntityAdapter many methods (@msutkowski - #444)