v1.0.0
Breaking changes
Action creators are now exported in their own object
Action creators returned by resources
is now contained in an actionCreators
object:
Before:
const { reducers, fetchUsers, getCollection } = resources({
// ...
After:
const { reducers, actionCreators: { fetchUsers }, getCollection } = resources({
// ...
Can no longer edit new resource items using the edit action creator
The edit
action creator is no longer used to edit the new resource. This used to be useful in situations where you wanted to define a new resource item over several steps before saving it to the server. Now the new editNew
action creator must be used for this.
Before:
const { reducers, fetchUsers, getCollection , newUser, editUser } = resources({
name: 'user's
}, [ 'new', 'edit' ]);
dispatch(newUser('temp', { firstName: 'Foo', lastName: 'Bar' }));
// ...
dispatch(editUser('temp', { lastName: 'Baz' }));
After:
const { reducers, fetchUsers, getCollection , actionCreators: { newUser, editNewUser } } = resources({
name: 'user's
}, [ 'new', 'editNew' ]);
dispatch(newUser('temp', { firstName: 'Foo', lastName: 'Bar' }));
// ...
dispatch(editNewUser('temp', { lastName: 'Baz' }));
See Edit the new resource item in the store for more information.
resourceType has been replaced by projection
Replaced resourceType
(a previously undocumented feature) with a projection
object for items and collections.
New features
- The
params
argument is now optional forcreate*()
andnew*()
action creators. A temporary id is automatically generated if one isn't specified, and the new item can continue to be accessed using thegetNewItem()
helper function. - Added a
localOnly
option for when you do not want to retrieve or save data to a remote API - Added a
syncedAt
attribute to thestatus
information for resource items and collections - Added a
occurredAt
attribute to thestatus
information when a resource item or collection is in an error state - Added TypeScript definitions for all module exports
- Add a new
requestAdaptor
option for adapting resource items and collections before passing them to be put into the body of create and update requests.
Improvements
- Readme improvements and corrections
- Added a contents section to the Readme
- Updated test and development dependencies
- Updated test suite to fix some inherent problems
- Internal refactoring to make the source code easier to follow
- Improved the specificity of developer warning messages to make them clearer