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

Function useDocumentDataOnce

firestore/useDocument.ts:126–142  ·  view source on GitHub ↗
(
  docRef?: DocumentReference<T> | null,
  options?: OnceDataOptions<T> & InitialValueOptions<T>
)

Source from the content-addressed store, hash-verified

124};
125
126export const useDocumentDataOnce = <T = DocumentData>(
127 docRef?: DocumentReference<T> | null,
128 options?: OnceDataOptions<T> & InitialValueOptions<T>
129): DocumentDataOnceHook<T> => {
130 const [snapshot, loading, error, reloadData] = useDocumentOnce<T>(
131 docRef,
132 options
133 );
134
135 const value = getValueFromSnapshot(
136 snapshot,
137 options?.snapshotOptions,
138 options?.initialValue
139 );
140
141 return [value, loading, error, snapshot, reloadData];
142};
143
144const getDocFnFromGetOptions = (
145 { source }: GetOptions = { source: 'default' }

Callers

nothing calls this directly

Calls 2

useDocumentOnceFunction · 0.85
getValueFromSnapshotFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…