Skip to content

Commit

Permalink
fix: renterd total file count
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfreska committed Jan 5, 2024
1 parent d2161c5 commit f5b4463
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/early-otters-pretend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'renterd': minor
---

The total file count now includes in-progress uploads.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useFiles } from '../../../contexts/files'
import { useObjectStats } from '@siafoundation/react-renterd'

export function FilesStatsMenuCount() {
const { isViewingABucket, pageCount } = useFiles()
const { isViewingABucket, pageCount, uploadsList } = useFiles()
const stats = useObjectStats({
config: {
swr: {
Expand All @@ -15,6 +15,10 @@ export function FilesStatsMenuCount() {
},
})

const numberObject = stats.data?.numObjects || 0
const uploadsInProgress = uploadsList.length
const totalObjects = numberObject + uploadsInProgress

if (isViewingABucket) {
return (
<div className="flex gap-1">
Expand All @@ -31,9 +35,7 @@ export function FilesStatsMenuCount() {
</Text>
<Tooltip side="bottom" content="Number of files across all buckets">
<Text size="12" font="mono">
{stats.data
? `${stats.data?.numObjects.toLocaleString()} files`
: ' files'}
{stats.data ? `${totalObjects.toLocaleString()} files` : ' files'}
</Text>
</Tooltip>
</div>
Expand All @@ -43,7 +45,7 @@ export function FilesStatsMenuCount() {
<Tooltip side="bottom" content="Number of files across all buckets">
{stats.data ? (
<Text size="12" font="mono">
{stats.data?.numObjects.toLocaleString()} files
{totalObjects.toLocaleString()} files
</Text>
) : (
<LoadingDots />
Expand Down

0 comments on commit f5b4463

Please sign in to comment.