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

Method has

packages/db/src/collection/state.ts:370–384  ·  view source on GitHub ↗

* Check if a key exists in the collection (virtual derived state)

(key: TKey)

Source from the content-addressed store, hash-verified

368 * Check if a key exists in the collection (virtual derived state)
369 */
370 public has(key: TKey): boolean {
371 const { optimisticDeletes, optimisticUpserts, syncedData } = this
372 // Check if optimistically deleted
373 if (optimisticDeletes.has(key)) {
374 return false
375 }
376
377 // Check optimistic upserts first
378 if (optimisticUpserts.has(key)) {
379 return true
380 }
381
382 // Fall back to synced data
383 return syncedData.has(key)
384 }
385
386 /**
387 * Get all keys (virtual derived state)

Callers 10

isRowSyncedMethod · 0.45
getRowOriginMethod · 0.45
getMethod · 0.45
keysMethod · 0.45
calculateSizeMethod · 0.45
getPreviousValueMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected