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

Function processMatchingStrategy

packages/electric-db-collection/src/electric.ts:860–874  ·  view source on GitHub ↗
(
    result: MatchingStrategy,
  )

Source from the content-addressed store, hash-verified

858 * Process matching strategy and wait for synchronization
859 */
860 const processMatchingStrategy = async (
861 result: MatchingStrategy,
862 ): Promise<void> => {
863 // Only wait if result contains txid
864 if (result && `txid` in result) {
865 const timeout = result.timeout
866 // Handle both single txid and array of txids
867 if (Array.isArray(result.txid)) {
868 await Promise.all(result.txid.map((txid) => awaitTxId(txid, timeout)))
869 } else {
870 await awaitTxId(result.txid, timeout)
871 }
872 }
873 // If result is void/undefined, don't wait - mutation completes immediately
874 }
875
876 // Create wrapper handlers for direct persistence operations that handle different matching strategies
877 const wrappedOnInsert = config.onInsert

Callers 1

Calls 2

awaitTxIdFunction · 0.85
mapMethod · 0.45

Tested by

no test coverage detected