Skip to content

Commit

Permalink
Fix off-by-zero error in table pagination (#2822)
Browse files Browse the repository at this point in the history
  • Loading branch information
Iinh authored May 15, 2024
1 parent 68b024c commit 83a22ab
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/components/controls/Pagination.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<Button
tooltip="move back a page"
on:click={() =>
currentPage === 1 ? undefined : changePage(currentPage - 1)}
currentPage === 0 ? undefined : changePage(currentPage - 1)}
level="medium"
compact
>
Expand All @@ -55,7 +55,7 @@
</Button>
</ButtonGroup>
page
{currentPage < 9 ? '0' : ''}{currentPage}
{currentPage < 9 ? '0' : ''}{Number(currentPage) + 1}
of
{totalPages < 9 ? '0' : ''}{totalPages}
</div>
2 changes: 1 addition & 1 deletion src/components/table/TableView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
<Pagination
on:page={(evt) => {
currentPage = evt.detail.page;
store.setField('currentPage', currentPage);
store.setField('currentPage', currentPage || 0);
}}
{totalPages}
currentPage={Number($store.currentPage)}
Expand Down
2 changes: 1 addition & 1 deletion src/state/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function getDefaultState(

state.aggKey = getFromQueryString('aggKey') || '';
state.aggType = getFromQueryString('aggType') || 'avg';
state.currentPage = getFromQueryString('currentPage') || '1';
state.currentPage = getFromQueryString('currentPage');
state.countView = getFromQueryString('countView') || 'clients';

state.probe = {
Expand Down

0 comments on commit 83a22ab

Please sign in to comment.