Skip to content

Commit

Permalink
fix(ListComputeUnitsTable): fix ListComputeUnitsTable
Browse files Browse the repository at this point in the history
  • Loading branch information
MixailE committed Feb 3, 2025
1 parent fc7f5cf commit dacd9a6
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/pages/capacity/ListComputeUnitsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ export const ListComputeUnitsTable: React.FC<ListComputeUnitsTableProps> = ({
(client) =>
client.getComputeUnitsByCapacityCommitment(
capacityCommitmentId,
offset,
limit + 1,
0,
1000,
orderBy,
orderType,
),
Expand All @@ -73,7 +73,12 @@ export const ListComputeUnitsTable: React.FC<ListComputeUnitsTableProps> = ({
)

const hasNextPage = computeUnits && computeUnits.data.length > limit
const pageComputeUnits = computeUnits && computeUnits.data.slice(0, limit)
const pageComputeUnits =
computeUnits &&
computeUnits.data.slice(
(page - 1) * COMPUTE_UNITS_PER_PAGE,
page * COMPUTE_UNITS_PER_PAGE,
)
const indexMultiplier = offset + 1

return (
Expand Down Expand Up @@ -103,14 +108,12 @@ export const ListComputeUnitsTable: React.FC<ListComputeUnitsTableProps> = ({
{!computeUnits ? (
<Skeleton width={200} height={34} count={1} />
) : (
computeUnits.total !== null && (
<Pagination
pages={getTotalPages(computeUnits.total)}
page={page}
hasNextPage={hasNextPage}
onSelect={selectPage}
/>
)
<Pagination
pages={getTotalPages(computeUnits.data.length)}
page={page}
hasNextPage={hasNextPage}
onSelect={selectPage}
/>
)}
</TablePagination>
</ListComputeUnitsTableWrapper>
Expand Down

0 comments on commit dacd9a6

Please sign in to comment.