Skip to content

fix: Don't show pagination during workspaces load #4743

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 25, 2022
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
Next Next commit
fix: Don't show pagination during workspaces load
  • Loading branch information
BrunoQuaresma committed Oct 25, 2022
commit 92f2867cb89bb2e8d27dd4ab088aab99f294fb55
6 changes: 3 additions & 3 deletions site/src/components/PaginationWidget/PaginationWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,15 @@ export const PaginationWidget = ({
activePage = 1,
containerStyle,
}: PaginationWidgetProps): JSX.Element | null => {
const numPages = numRecords ? Math.ceil(numRecords / numRecordsPerPage) : 0
const numPages = numRecords ? Math.ceil(numRecords / numRecordsPerPage) : 1
const firstPageActive = activePage === 1 && numPages !== 0
const lastPageActive = activePage === numPages && numPages !== 0
const theme = useTheme()
const isMobile = useMediaQuery(theme.breakpoints.down("sm"))
const styles = useStyles()

// No need to display any pagination if we know the number of pages is 1
if (numPages === 1 || numRecords === 0) {
// No need to display any pagination if we know the number of pages is 1 or 0
if (numPages <= 1 || numRecords === 0) {
return null
}

Expand Down