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

Function acceptMutations

packages/db/src/local-only.ts:249–265  ·  view source on GitHub ↗
(transaction: {
    mutations: Array<PendingMutation<Record<string, unknown>>>
  })

Source from the content-addressed store, hash-verified

247 * Accepts mutations from a transaction that belong to this collection and persists them
248 */
249 const acceptMutations = (transaction: {
250 mutations: Array<PendingMutation<Record<string, unknown>>>
251 }) => {
252 // Filter mutations that belong to this collection
253 const collectionMutations = transaction.mutations.filter(
254 (m) => m.collection.id === collectionId,
255 )
256
257 if (collectionMutations.length === 0) {
258 return
259 }
260
261 // Persist the mutations through sync
262 syncResult.confirmOperationsSync(
263 collectionMutations as Array<PendingMutation<T>>,
264 )
265 }
266
267 return {
268 ...restConfig,

Callers

nothing calls this directly

Calls 1

filterMethod · 0.80

Tested by

no test coverage detected