A hook that is triggered before an update()
operation.
The beforeUpdate()
hook runs when:
update()
function is called.The hook also runs when an action is performed on a dataset that updates an item from the collection that the dataset is connected to.
Return an object or a Promise that resolves to an object from the beforeUpdate()
function. The returned object will be updated in the collection instead of
the original item passed to the update()
function.
If the returned value is of the wrong type, the value is ignored.
A rejected Promise blocks the call to update()
and also calls the onFailure()
hook if it has been registered.
Because the beforeUpdate()
hook is called before the update()
is executed, it can affect the item that is updated in the collection
or block the update()
.
The original item to be updated.
Contextual information about the hook.