StoreBeforeDeleteHandler
See source codeHandler function called before a record is deleted from the store.
The handler can return false
to prevent the deletion from occurring.
type StoreBeforeDeleteHandler<R extends UnknownRecord> = (
record: R,
source: 'remote' | 'user'
) => false | void
Example
const handler: StoreBeforeDeleteHandler<BookRecord> = (book, source) => {
// Prevent deletion of books that are currently checked out
if (book.isCheckedOut) {
console.warn('Cannot delete checked out book')
return false
}
// Allow deletion for other books
}
Parameters
Name | Description |
---|---|
| The record about to be deleted |
| Whether the change originated from 'user' interaction or 'remote' synchronization |
Prev
StoreBeforeCreateHandlerNext
StoreListener