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

Method state

packages/db/src/collection/index.ts:821–827  ·  view source on GitHub ↗

* Gets the current state of the collection as a Map * @returns Map containing all items in the collection, with keys as identifiers * @example * const itemsMap = collection.state * console.log(`Collection has ${itemsMap.size} items`) * * for (const [key, item] of itemsMap) { *

()

Source from the content-addressed store, hash-verified

819 * }
820 */
821 get state() {
822 const result = new Map<TKey, WithVirtualProps<TOutput, TKey>>()
823 for (const [key, value] of this.entries()) {
824 result.set(key, value)
825 }
826 return result
827 }
828
829 /**
830 * Gets the current state of the collection as a Map, but only resolves when data is available

Callers 1

Calls 2

entriesMethod · 0.95
setMethod · 0.45

Tested by

no test coverage detected