MCPcopy Create free account
hub / github.com/CSFrequency/react-firebase-hooks / getValuesFromSnapshots

Function getValuesFromSnapshots

firestore/useCollection.ts:139–151  ·  view source on GitHub ↗
(
  snapshots: QuerySnapshot<T> | undefined,
  options?: SnapshotOptions,
  initialValue?: T[]
)

Source from the content-addressed store, hash-verified

137};
138
139const getValuesFromSnapshots = <T>(
140 snapshots: QuerySnapshot<T> | undefined,
141 options?: SnapshotOptions,
142 initialValue?: T[]
143): T[] | undefined => {
144 return useMemo(
145 () =>
146 (snapshots?.docs.map((doc) => doc.data(options)) ?? initialValue) as
147 | T[]
148 | undefined,
149 [snapshots, options]
150 );
151};
152
153const getDocsFnFromGetOptions = (
154 { source }: GetOptions = { source: 'default' }

Callers 2

useCollectionDataFunction · 0.85
useCollectionDataOnceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…