parcels
Change Requests
- Added ChangeRequests
- All changes are now described as a change request, which contains an array of actions, information about the originator of the change, and optional metadata associated with the change.
Parcel.dispatch() now accepts either an action, an array of actions, or a change request.
- Potential big performance gains in future. We can now do caching so we can avoid hitting the reducer (slow) at every point where the changed data is required.
- Clearer mental model (parcels never go up!)
- Provides a place for change meta to exist
- Note this can't really be used until #35 exposes it
- Provides a place for origin identifying information to exist
- Simplifies
modifyChanges usage
parcels now exports {ChangeRequest}
- BREAKING CHANGE
Parcel.modifyChange() has changed. The previous setup was temporary. Now it accepts a function that receives two arguments: the parcel that modifyChange is being called on, and a changeRequest.
- Instead of
newParcelData(), use changeRequest.data()
- Instead of
actions, use changeRequest.actions()
- Instead of
continueChange(), use parcel.dispatch(changeRequest)
Parcel.batch() now accepts an optional second argument changeRequest. If set, this change request's meta data and origin information will be used by the batcher.
- Added
Parcel.modifyChangeValue(). It accepts a function that updates the value in the current change request.
- Add
Parcel.setChangeRequestMeta() This sets meta on the change request (a separate concept to Parcel.meta()). You'll almost certainly use this inside a Parcel.batch()
- Added
Action.isValueAction() and Action.isMetaAction()
Types
- Added runtime type checking to
Parcel constructor and methods, errors will be thrown if given the wrong stuff
API changes
- BREAKING CHANGE Remove
Parcel.equals() and use it only in PureParcel, because it was too opinionated in how it calculated equality to put on Parcel's api
- BREAKING CHANGE Remove
Parcel.findAllMatching() and move it to the util directory
- BREAKING CHANGE Remove
Parcel.addPreModifier(), this was added to make it easier to access a parcel directly from state from multiple pieces of code and make sure that it already had any necessary modifiers applied to it, but going forward it's better to get people to use the ParcelStateHock and it's modify method as a single point of access to a parcel. People who don't want to use that can easily make a method that gets their parcel from state and modifies it before using it.
Bug fixes
- Fix bug where
Parcel.findAllMatching() would think globstars in a match string count as wildcards #43
Internal
- More tests added to increase coverage
- Begin fixing internal flow types
parcels-react
Change Requests
parcels-react now exports {ChangeRequest}
parcels-react now exports all of parcels types
Types
- BREAKING CHANGE
ParcelStateHock no longer provides a default prop name. You must give one yourself. This is to encourage good naming conventions where the prop name relates to the value of the parcel (like "person", "address" etc), and not to the fact it is a parcel. Parcel props named "parcel" aren't great.
- Added runtime type checking to
ParcelStateHock constructor and methods, errors will be thrown if given the wrong stuff
parcels-react now exports parcels types
parcels-plugin-form
Addresses #46 #43 #35 #32 and #31