Version: Next
ListDelete Plugin
#
Use casesThis plugin provides support for deleting items in list-based states. It must be used with care on paginated lists, because it will likely break pagination (i.e. it removes from the current page, likely leaving it with one item less than page size)
#
ConfigurationThis plugin supports some configuration options:
- path: the path, relative to the state root, where the list is stored (defaults to 'data')
- identity: this function is called once for every element in the list, and is expected to return
true
if the item passed in along with the deleting action is the target of the delete operation ((action, listItem) => bool
). Default value is(action, listItem) => action.item.id === listItem.id
#
UsageThis plugin is already included in rjPlainList and even in rjList (even if it should be used with care), but you may want to customize, for instance, the identity function. It is possible to add it explicitly to a RocketJump in order to override the behaviour of the provided one.
#
ActionsThis plugin injects in the actions
bag the following action creators:
- deleteItem (
deleteItem(item)
): deletes zero or more items from the list, according to theidentity
function