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

Method get

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

* Get the current value for a key (virtual derived state)

(key: TKey)

Source from the content-addressed store, hash-verified

349 * Get the current value for a key (virtual derived state)
350 */
351 public get(key: TKey): TOutput | undefined {
352 const { optimisticDeletes, optimisticUpserts, syncedData } = this
353 // Check if optimistically deleted
354 if (optimisticDeletes.has(key)) {
355 return undefined
356 }
357
358 // Check optimistic upserts first
359 if (optimisticUpserts.has(key)) {
360 return optimisticUpserts.get(key)
361 }
362
363 // Fall back to synced data
364 return syncedData.get(key)
365 }
366
367 /**
368 * Check if a key exists in the collection (virtual derived state)

Callers 11

getWithVirtualPropsMethod · 0.95
valuesMethod · 0.95
entriesMethod · 0.95
getRowOriginMethod · 0.45
getPreviousValueMethod · 0.45

Calls 1

hasMethod · 0.45

Tested by

no test coverage detected