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

Method getPreviousValue

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

* Get the previous value for a key given previous optimistic state

(
    key: TKey,
    previousUpserts: Map<TKey, TOutput>,
    previousDeletes: Set<TKey>,
  )

Source from the content-addressed store, hash-verified

797 * Get the previous value for a key given previous optimistic state
798 */
799 private getPreviousValue(
800 key: TKey,
801 previousUpserts: Map<TKey, TOutput>,
802 previousDeletes: Set<TKey>,
803 ): TOutput | undefined {
804 if (previousDeletes.has(key)) {
805 return undefined
806 }
807 if (previousUpserts.has(key)) {
808 return previousUpserts.get(key)
809 }
810 return this.syncedData.get(key)
811 }
812
813 /**
814 * Attempts to commit pending synced transactions if there are no active transactions

Callers 1

Calls 2

hasMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected