Add MAX_PAGING_RESULTS on hooks for performance improvements.

This commit is contained in:
Francis Cao committed 2026-05-04 15:43:05 -07:00
1 parent a8c1f26775
commit fbac7518fc
17 files changed
+74 -215

No files matched your search

+6 -3
View File
@@ -6,11 +6,12 @@ export interface PagerProps {
page: string | number;
pageSize: string | number;
count: string | number;
isCapped?: boolean;
onPageChange: (nextPage: number) => void;
className?: string;
}
export function Pager({ page, pageSize, count, onPageChange }: PagerProps) {
export function Pager({ page, pageSize, count, isCapped, onPageChange }: PagerProps) {
const { t, labels } = useMessages();
const maxPage = pageSize && count ? Math.ceil(+count / +pageSize) : 0;
const lastPage = page === maxPage;
@@ -28,13 +29,15 @@ export function Pager({ page, pageSize, count, onPageChange }: PagerProps) {
}
};
if (maxPage === 1) {
if (maxPage === 1 && !isCapped) {
return null;
}
const displayCount = isCapped ? `10,000+` : (+count).toLocaleString();
return (
<Row alignItems="center" justifyContent="space-between" gap="3" flexGrow={1}>
<Text>{t(labels.numberOfRecords, { x: count.toLocaleString() })}</Text>
<Text>{t(labels.numberOfRecords, { x: displayCount })}</Text>
<Row alignItems="center" justifyContent="flex-end" gap="3">
<Text>
{t(labels.pageOf, {