From bb2f0f368fd542e8f89b37ac0eef8150f5553032 Mon Sep 17 00:00:00 2001 From: Presley Pizzo Date: Wed, 19 Oct 2022 15:16:41 +0000 Subject: [PATCH] Hide widget with 0 records --- site/src/components/PaginationWidget/PaginationWidget.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/site/src/components/PaginationWidget/PaginationWidget.tsx b/site/src/components/PaginationWidget/PaginationWidget.tsx index 7018e6a5ac..bede3d090c 100644 --- a/site/src/components/PaginationWidget/PaginationWidget.tsx +++ b/site/src/components/PaginationWidget/PaginationWidget.tsx @@ -27,7 +27,7 @@ export type PaginationWidgetProps = { const range = (start: number, stop: number, step = 1) => Array.from({ length: (stop - start) / step + 1 }, (_, i) => start + i * step) -export const DEFAULT_RECORDS_PER_PAGE = 25 +export const DEFAULT_RECORDS_PER_PAGE = 2 // Number of pages to the left or right of the current page selection. const PAGE_NEIGHBORS = 1 // Number of pages displayed for cases where there are multiple ellipsis showing. This can be @@ -128,7 +128,7 @@ export const PaginationWidget = ({ const styles = useStyles() // No need to display any pagination if we know the number of pages is 1 - if (numPages === 1) { + if (numPages === 1 || numRecords === 0) { return null }