StoreAfterChangeHandler
See source codeHandler function called after a record has been successfully updated in the store. Use this for side effects that should happen after record changes, such as updating related records or maintaining consistency constraints.
type StoreAfterChangeHandler<R extends UnknownRecord> = (
prev: R,
next: R,
source: 'remote' | 'user'
) => void
Example
const handler: StoreAfterChangeHandler<ShapeRecord> = (prev, next, source) => {
// Update connected arrows when a shape moves
if (prev.x !== next.x || prev.y !== next.y) {
updateConnectedArrows(next.id)
}
}
Parameters
Name | Description |
---|---|
| The previous version of the record |
| The new version of the record that was stored |
| Whether the change originated from 'user' interaction or 'remote' synchronization |
Prev
SerializedStoreNext
StoreAfterCreateHandler