Skip to content

Commit

Permalink
Use two dataset count consts
Browse files Browse the repository at this point in the history
One for filtered values, one for non-filtered
  • Loading branch information
multikatt committed Nov 27, 2023
1 parent 1b436b3 commit 926b8b7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions apps/renterd/components/Contracts/ContractsFilterBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useContracts } from '../../contexts/contracts'
import { ContractsFilterMenu } from './ContractsFilterMenu'

export function ContractsFilterBar() {
const { dataState, offset, limit, datasetCount, pageCount } = useContracts()
const { dataState, offset, limit, datasetFilteredCount, pageCount } = useContracts()

return (
<div className="flex gap-2 w-full">
Expand All @@ -13,7 +13,7 @@ export function ContractsFilterBar() {
isLoading={dataState === 'loading'}
offset={offset}
limit={limit}
datasetTotal={datasetCount}
datasetTotal={datasetFilteredCount}
pageTotal={pageCount}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import { useRedundancySettings } from '../../../hooks/useRedundancySettings'

export function useNotEnoughContracts() {
const redundancy = useRedundancySettings()
const { dataset, isLoading: isContractsLoading } = useContracts()
const datasetCount = dataset?.length || 0
const { datasetCount, isLoading: isContractsLoading } = useContracts()

const active =
redundancy.data &&
Expand Down
3 changes: 2 additions & 1 deletion apps/renterd/contexts/contracts/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ function useContractsMain() {
isLoading: response.isLoading,
error: response.error,
pageCount: datasetPage?.length || 0,
datasetCount: datasetFiltered?.length || 0,
datasetCount: dataset?.length || 0,
datasetFilteredCount: datasetFiltered?.length || 0,
columns: filteredTableColumns,
dataset,
datasetPage,
Expand Down

0 comments on commit 926b8b7

Please sign in to comment.