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

Function confirmOperationsSync

packages/db/src/local-storage.ts:850–868  ·  view source on GitHub ↗
(mutations: Array<any>)

Source from the content-addressed store, hash-verified

848 * @param mutations - Array of mutation objects to confirm
849 */
850 const confirmOperationsSync = (mutations: Array<any>) => {
851 if (!syncParams) {
852 // Sync not initialized yet, mutations will be handled on next sync
853 return
854 }
855
856 const { begin, write, commit } = syncParams
857
858 // Write the mutations through sync to confirm them
859 begin()
860 mutations.forEach((mutation: any) => {
861 write({
862 type: mutation.type,
863 value:
864 mutation.type === `delete` ? mutation.original : mutation.modified,
865 })
866 })
867 commit()
868 }
869
870 return {
871 ...syncConfig,

Callers

nothing calls this directly

Calls 1

forEachMethod · 0.45

Tested by

no test coverage detected