Skip to content

fix(site): do not return next page if the current size is lower than the limit #10287

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 2 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
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(site): do not return next page if the current size is lower than …
…limit
  • Loading branch information
BrunoQuaresma committed Oct 16, 2023
commit 06f6e5a814279033dc5ef8dff998f66456eb3abd
3 changes: 3 additions & 0 deletions site/src/api/queries/workspaceBuilds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ export const infiniteWorkspaceBuilds = (
return {
queryKey: ["workspaceBuilds", workspaceId, req],
getNextPageParam: (lastPage, pages) => {
if (lastPage.length < limit) {
return undefined;
}
return pages.length + 1;
},
queryFn: ({ pageParam = 0 }) => {
Expand Down
2 changes: 2 additions & 0 deletions site/src/pages/WorkspacePage/WorkspacePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ export const WorkspacePage: FC = () => {
enabled: Boolean(workspace),
});

console.log(buildsQuery.hasNextPage);

if (pageError) {
return (
<Margins>
Expand Down