StoreAfterDeleteHandler

See source code

Handler function called after a record has been successfully deleted from the store. Use this for cleanup operations and maintaining referential integrity.

type StoreAfterDeleteHandler<R extends UnknownRecord> = (
  record: R,
  source: 'remote' | 'user'
) => void

Example

const handler: StoreAfterDeleteHandler<ShapeRecord> = (shape, source) => {
  // Clean up arrows that were connected to this shape
  const connectedArrows = findArrowsConnectedTo(shape.id)
  store.remove(connectedArrows.map((arrow) => arrow.id))
}

Parameters

NameDescription

record

The record that was deleted

source

Whether the change originated from 'user' interaction or 'remote' synchronization

Prev
StoreAfterCreateHandler
Next
StoreBeforeChangeHandler