MCPcopy Index your code
hub / github.com/TanStack/db / enhancedInternalSync

Function enhancedInternalSync

packages/query-db-collection/src/query.ts:1864–1887  ·  view source on GitHub ↗
(params)

Source from the content-addressed store, hash-verified

1862
1863 // Enhanced internalSync that captures write functions for manual use
1864 const enhancedInternalSync: SyncConfig<any>[`sync`] = (params) => {
1865 const { begin, write, commit, collection } = params
1866
1867 // Get the base query key for the context (handle both static and function-based keys)
1868 const contextQueryKey =
1869 typeof queryKey === `function`
1870 ? (queryKey({}) as unknown as Array<unknown>)
1871 : (queryKey as unknown as Array<unknown>)
1872
1873 // Store references for manual write operations
1874 writeContext = {
1875 collection,
1876 queryClient,
1877 queryKey: contextQueryKey,
1878 getKey: getKey as (item: any) => string | number,
1879 begin,
1880 write,
1881 commit,
1882 updateCacheData,
1883 }
1884
1885 // Call the original internalSync logic
1886 return internalSync(params)
1887 }
1888
1889 // Create write utils using the manual-sync module
1890 const writeUtils = createWriteUtils<any, string | number, any>(

Callers

nothing calls this directly

Calls 2

queryKeyFunction · 0.85
internalSyncFunction · 0.85

Tested by

no test coverage detected