From 250ee17933e6d47f83aa82e5f20b63feab1b5408 Mon Sep 17 00:00:00 2001 From: Steven Masley Date: Wed, 22 Mar 2023 13:17:49 -0500 Subject: [PATCH] fix: Page offset on workspace pagination was incorrect (#6693) * fix: Page offset on workspace pagination was incorrect --- site/src/pages/WorkspacesPage/data.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/site/src/pages/WorkspacesPage/data.ts b/site/src/pages/WorkspacesPage/data.ts index 5ea3bbeeff..799d94dc61 100644 --- a/site/src/pages/WorkspacesPage/data.ts +++ b/site/src/pages/WorkspacesPage/data.ts @@ -32,7 +32,9 @@ export const useWorkspacesData = ({ getWorkspaces({ q: query, limit: limit, - offset: page, + // If the page is <= 0, just use offset 0. This usually happens + // if the page is not provided. + offset: page <= 0 ? 0 : (page - 1) * limit, }), refetchInterval: 5_000, })