From b0aa91bf27073977632c43e9124fd7ec81e4ecff Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Tue, 7 Nov 2023 09:36:26 -0500 Subject: [PATCH] fix: disable pagination nav buttons correctly (#10561) * fix: update button disabling logic --- .../components/PaginationWidget/PaginationWidgetBase.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/site/src/components/PaginationWidget/PaginationWidgetBase.tsx b/site/src/components/PaginationWidget/PaginationWidgetBase.tsx index f72e9632ff..56f3767859 100644 --- a/site/src/components/PaginationWidget/PaginationWidgetBase.tsx +++ b/site/src/components/PaginationWidget/PaginationWidgetBase.tsx @@ -21,14 +21,15 @@ export const PaginationWidgetBase = ({ }: PaginationWidgetBaseProps): JSX.Element | null => { const theme = useTheme(); const isMobile = useMediaQuery(theme.breakpoints.down("md")); - const numPages = Math.ceil(count / limit); - const isFirstPage = page === 0; - const isLastPage = page === numPages - 1; + const numPages = Math.ceil(count / limit); if (numPages < 2) { return null; } + const isFirstPage = page <= 1; + const isLastPage = page >= numPages; + return (