MCPcopy Index your code
hub / github.com/FirebaseExtended/reactfire / useFirestoreDocDataOnce

Function useFirestoreDocDataOnce

src/firestore.tsx:74–81  ·  view source on GitHub ↗
(ref: DocumentReference<T>, options?: ReactFireOptions<T>)

Source from the content-addressed store, hash-verified

72 * Get a Firestore document, unwrap the document into a plain object, and don't subscribe to changes
73 */
74export function useFirestoreDocDataOnce<T = unknown>(ref: DocumentReference<T>, options?: ReactFireOptions<T>): ObservableStatus<T> {
75 const idField = options ? checkIdField(options) : 'NO_ID_FIELD';
76
77 const observableId = `firestore:docDataOnce:${ref.firestore.app.name}:${ref.path}:idField=${idField}`;
78 const observable$ = docData(ref, { idField }).pipe(first());
79
80 return useObservable(observableId, observable$, options);
81}
82
83/**
84 * Subscribe to a Firestore collection

Callers 3

StaticValueFunction · 0.85
StaticValueFunction · 0.85
firestore.test.tsxFile · 0.85

Calls 2

checkIdFieldFunction · 0.85
useObservableFunction · 0.85

Tested by

no test coverage detected