fix: Manage Files count shows all files while searching (#32816)

The number next to the Files title in Manage Files stayed at the account's total while a search narrowed the list. While searching it now shows how many files are listed for the search, as before the redesign, and the total comes back once the search is cleared.

Fixes #32815
This commit is contained in:
Classic298 2026-10-21 09:38:15 +02:00 • committed by GitHub
parent 3539ad6321
commit c503f21470
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -55,6 +55,7 @@
$: busy = selectionStatus === 'loading' || !!operation || showDeleteConfirmDialog;
$: loadedSelected = (files ?? []).filter((file) => selectedIds.has(file.id)).length;
$: allLoadedSelected = !!files?.length && loadedSelected === files.length;
$: shownFileCount = query ? (files?.length ?? null) : fileCount;
$: sortedFiles = [...(files ?? [])].sort((a, b) => {
const result =
orderBy === 'filename'
@ -80,7 +81,7 @@
files = more ? [...(files ?? []), ...result] : result;
page = nextPage;
allFilesLoaded = result.length < PAGE_SIZE;
if (!more) {
if (!more && !query) {
const count = await getUserFileCount(localStorage.token);
if (request === generation) fileCount = count;
}
@ -252,8 +253,8 @@
<div class="mb-2 flex h-6 items-center gap-2">
<div class="flex flex-1 items-center gap-1.5 text-sm font-medium">
{$i18n.t('Files')}
{#if fileCount !== null}<span class="text-xs font-normal tabular-nums text-gray-400"
>{fileCount}</span
{#if shownFileCount !== null}<span class="text-xs font-normal tabular-nums text-gray-400"
>{shownFileCount}</span
>{/if}
</div>
<Dropdown closeOnSelect align="end">