( query?: Query<T> | null, options?: OnceDataOptions<T> & InitialValueOptions<T[]> )
| 119 | }; |
| 120 | |
| 121 | export const useCollectionDataOnce = <T = DocumentData>( |
| 122 | query?: Query<T> | null, |
| 123 | options?: OnceDataOptions<T> & InitialValueOptions<T[]> |
| 124 | ): CollectionDataOnceHook<T> => { |
| 125 | const [snapshots, loading, error, reloadData] = useCollectionOnce<T>( |
| 126 | query, |
| 127 | options |
| 128 | ); |
| 129 | |
| 130 | const values = getValuesFromSnapshots<T>( |
| 131 | snapshots, |
| 132 | options?.snapshotOptions, |
| 133 | options?.initialValue |
| 134 | ); |
| 135 | |
| 136 | return [values, loading, error, snapshots, reloadData]; |
| 137 | }; |
| 138 | |
| 139 | const getValuesFromSnapshots = <T>( |
| 140 | snapshots: QuerySnapshot<T> | undefined, |
nothing calls this directly
no test coverage detected
searching dependent graphs…