1
1
import firebase from 'firebase/app' ;
2
2
import { useEffect , useMemo } from 'react' ;
3
- import { snapshotToData } from './helpers' ;
3
+ import { DataOptions , Options , snapshotToData } from './helpers' ;
4
4
import { LoadingHook , useIsEqualRef , useLoadingValue } from '../util' ;
5
5
6
6
export type CollectionHook < T > = LoadingHook <
@@ -11,9 +11,7 @@ export type CollectionDataHook<T> = LoadingHook<T[], Error>;
11
11
12
12
export const useCollection = < T > (
13
13
query ?: firebase . firestore . Query | null ,
14
- options ?: {
15
- snapshotListenOptions ?: firebase . firestore . SnapshotListenOptions ;
16
- }
14
+ options ?: Options ,
17
15
) : CollectionHook < T > => {
18
16
const { error, loading, reset, setError, setValue, value } = useLoadingValue <
19
17
firebase . firestore . QuerySnapshot ,
@@ -50,11 +48,7 @@ export const useCollection = <T>(
50
48
51
49
export const useCollectionData = < T > (
52
50
query ?: firebase . firestore . Query | null ,
53
- options ?: {
54
- idField ?: string ;
55
- refField ?: string ;
56
- snapshotListenOptions ?: firebase . firestore . SnapshotListenOptions ;
57
- }
51
+ options ?: DataOptions
58
52
) : CollectionDataHook < T > => {
59
53
const idField = options ? options . idField : undefined ;
60
54
const refField = options ? options . refField : undefined ;
0 commit comments