ValidModifier, ping(), hasDispatched(), meta()
·
1020 commits
to master
since this release
parcels
- BREAKING CHANGE
Parcel.meta(key: Key): *no longer exists, just call.meta()and look in the object - BREAKING CHANGE
Parcel.refresh()has been removed due to it's reliance on having to have previously created child parcels usingget()in order for them to be refreshed. Parcel. ping()has been added. It dispatched thepingaction which already existed, which changes no data but allows the top level parcels to receive data from the dispatcher.Parcel. hasDispatched(): booleanhas been added. It returns a boolean stating whether a parcel at the current location has dispatched anything yet.Parcel. findAllMatching(match: string): Parcel[]has been added. It returns an array of all descendant parcels (and possibly itself) that match the match string provided. Note does not work with match strings containing a globstar.Parcel.getInternalLocationShareData()andParcel.setInternalLocationShareData(partialData: Object)have been added. Not really intended for public use, but modifiers may sometimes need these to be able to share data with all parcel instances at the same location without triggering changes.Parcel.initialMeta(partialMeta: Object)is now chainable, meaning that two parcels at the same location can both callinitialMeta()and the second call will work.
parcels-react
- No changes
parcels-plugin-form
- BREAKING CHANGE
ValidModifiernow accepts a function that returns an object, instead of just an object.
Before
validators: {
"name": [isRequired],
"email": [isRequired, isEmail]
}
After
validators: (parcel) => ({
"name": [isRequired],
"email": [isRequired, isEmail]
})
ValidModifiercan now cope with falsey items being passed into its config, so you can now conditionally add validation depending on the value of the parcel:
validators: (parcel) => ({
"name": [isRequired],
"email": [isRequired, isEmail],
"cool": parcel.value().isCool() && [isRequired],
"something": [isRequired, parcel.value().isCool() && isAmazing],
})
- Internally validator now works much better. On submit it iterates over the keys passed to it,
ping()s each parcels that it hasn't received an action from yet so it contains up-to-date data, then calls all the validators.
Based off #43