Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Firestore is green
  • Loading branch information
jamesdaniels committed Feb 10, 2020
commit c423a30d9871d3731784e8e3e1132763af252072
13 changes: 7 additions & 6 deletions reactfire/firestore/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function useFirestoreDoc<T = unknown>(
): T extends {} ? T : firestore.DocumentSnapshot {
return useObservable(
doc(ref),
'firestore doc: ' + ref.path,
`useFirestoreDoc:${ref.path}`,
options ? options.startWithValue : undefined
);
}
Expand All @@ -61,7 +61,7 @@ export function useFirestoreDocData<T = unknown>(
): T {
return useObservable(
docData(ref, checkIdField(options)),
'firestore docdata: ' + ref.path,
`useFirestoreDocData:${ref.path}`,
checkStartWithValue(options)
);
}
Expand All @@ -76,7 +76,7 @@ export function useFirestoreCollection<T = { [key: string]: unknown }>(
query: firestore.Query,
options?: ReactFireOptions<T[]>
): T extends {} ? T[] : firestore.QuerySnapshot {
const queryId = getHashFromFirestoreQuery(query);
const queryId = `useFirestoreCollection:${getHashFromFirestoreQuery(query)}`;

return useObservable(
fromCollectionRef(query, checkIdField(options)),
Expand All @@ -96,8 +96,7 @@ interface _QueryWithId extends firestore.Query {
}

function getHashFromFirestoreQuery(query: firestore.Query) {
const hash = (query as _QueryWithId)._query.canonicalId();
return `firestore: ${hash}`;
return (query as _QueryWithId)._query.canonicalId();
}

/**
Expand All @@ -110,7 +109,9 @@ export function useFirestoreCollectionData<T = { [key: string]: unknown }>(
query: firestore.Query,
options?: ReactFireOptions<T[]>
): T[] {
const queryId = getHashFromFirestoreQuery(query);
const queryId = `useFirestoreCollectionData:${getHashFromFirestoreQuery(
query
)}`;

return useObservable(
collectionData(query, checkIdField(options)),
Expand Down