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

Function wrappedOnUpdate

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

Source from the content-addressed store, hash-verified

211 * Wrapper for onUpdate handler that also confirms the transaction immediately
212 */
213 const wrappedOnUpdate = async (
214 params: UpdateMutationFnParams<T, TKey, LocalOnlyCollectionUtils>,
215 ) => {
216 // Call user handler first if provided
217 let handlerResult
218 if (onUpdate) {
219 handlerResult = (await onUpdate(params)) ?? {}
220 }
221
222 // Then synchronously confirm the transaction by looping through mutations
223 syncResult.confirmOperationsSync(params.transaction.mutations)
224
225 return handlerResult
226 }
227
228 /**
229 * Wrapper for onDelete handler that also confirms the transaction immediately

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected