MCPcopy Create free account
hub / github.com/TanStack/db / wrappedOnDelete

Function wrappedOnDelete

packages/db/src/local-only.ts:231–244  ·  view source on GitHub ↗
(
    params: DeleteMutationFnParams<T, TKey, LocalOnlyCollectionUtils>,
  )

Source from the content-addressed store, hash-verified

229 * Wrapper for onDelete handler that also confirms the transaction immediately
230 */
231 const wrappedOnDelete = async (
232 params: DeleteMutationFnParams<T, TKey, LocalOnlyCollectionUtils>,
233 ) => {
234 // Call user handler first if provided
235 let handlerResult
236 if (onDelete) {
237 handlerResult = (await onDelete(params)) ?? {}
238 }
239
240 // Then synchronously confirm the transaction by looping through mutations
241 syncResult.confirmOperationsSync(params.transaction.mutations)
242
243 return handlerResult
244 }
245
246 /**
247 * Accepts mutations from a transaction that belong to this collection and persists them

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected