mirror of
https://github.com/rowyio/rowy.git
synced 2025-12-28 16:06:41 +01:00
Merge branch 'develop' into feature/rowy-706-table-upgrade
# Conflicts: # src/atoms/tableScope/table.ts # src/components/TableToolbar/LoadedRowsStatus.tsx # src/hooks/useFirestoreCollectionWithAtom.ts
This commit is contained in:
@@ -239,5 +239,8 @@ export type AuditChangeFunction = (
|
||||
*/
|
||||
export const auditChangeAtom = atom<AuditChangeFunction | undefined>(undefined);
|
||||
|
||||
/** Store total number of rows in firestore collection */
|
||||
export const serverDocCountAtom = atom(0);
|
||||
/**
|
||||
* Store total number of rows in the table, respecting current filters.
|
||||
* If `undefined`, the query hasn’t loaded yet.
|
||||
*/
|
||||
export const serverDocCountAtom = atom<number | undefined>(undefined);
|
||||
|
||||
@@ -69,8 +69,9 @@ function LoadedRowsStatus() {
|
||||
<StatusText>
|
||||
<SyncIcon style={{ transform: "rotate(45deg)" }} />
|
||||
Loaded {!tableNextPage.available && "all "}
|
||||
{tableRows.length} {tableNextPage.available && `of ${serverDocCount}`}{" "}
|
||||
row{serverDocCount !== 1 && "s"}
|
||||
{tableRows.length}
|
||||
{serverDocCount !== undefined && ` of ${serverDocCount}`} row
|
||||
{(serverDocCount ?? tableRows.length) !== 1 && "s"}
|
||||
</StatusText>
|
||||
</Tooltip>
|
||||
);
|
||||
|
||||
@@ -64,7 +64,7 @@ interface IUseFirestoreCollectionWithAtomOptions<T> {
|
||||
/** Update this atom when we’re loading the next page, and if there is a next page available. Uses same scope as `dataScope`. */
|
||||
nextPageAtom?: PrimitiveAtom<NextPageState>;
|
||||
/** Set this atom's value to the number of docs in the collection on each new snapshot */
|
||||
serverDocCountAtom?: PrimitiveAtom<number> | undefined;
|
||||
serverDocCountAtom?: PrimitiveAtom<number | undefined>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -235,6 +235,7 @@ export function useFirestoreCollectionWithAtom<T = TableRow>(
|
||||
handleError,
|
||||
nextPageAtom,
|
||||
setNextPageAtom,
|
||||
serverDocCountAtom,
|
||||
setServerDocCountAtom,
|
||||
]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user