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

Function deferredMutation

packages/offline-transactions/tests/offline-e2e.test.ts:430–450  ·  view source on GitHub ↗
(
      params: OfflineMutationFnParams & { attempt: number },
    )

Source from the content-addressed store, hash-verified

428 let env: ReturnType<typeof createTestOfflineEnvironment> | undefined
429
430 const deferredMutation = async (
431 params: OfflineMutationFnParams & { attempt: number },
432 ) => {
433 const runtimeEnv = env
434 if (!runtimeEnv) {
435 throw new Error(`env not initialized`)
436 }
437
438 const mutations = params.transaction.mutations as Array<
439 PendingMutation<TestItem>
440 >
441
442 await new Promise<void>((resolve) => {
443 pendingResolvers.push(() => {
444 runtimeEnv.applyMutations(mutations)
445 resolve()
446 })
447 })
448
449 return { ok: true, mutations }
450 }
451
452 env = createTestOfflineEnvironment({
453 mutationFn: deferredMutation,

Callers

nothing calls this directly

Calls 1

applyMutationsMethod · 0.80

Tested by

no test coverage detected