fix(files): total size reflects displayed rows, not all loaded results

When orphan filter is active, total was summing all 50 loaded files
rather than the filtered subset shown in the table.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Scott Idem
2026-06-18 18:56:24 -04:00
parent ed87d1c1ef
commit af636f5b53

View File

@@ -336,8 +336,6 @@ function fmt_date(val: string | Date | null | undefined) {
return ae_util.iso_datetime_formatter(val as any, 'datetime_12_short'); return ae_util.iso_datetime_formatter(val as any, 'datetime_12_short');
} }
let total_size = $derived(results.reduce((sum, f) => sum + (f.size ?? 0), 0));
// ── Orphan check ────────────────────────────────────────────────────────────── // ── Orphan check ──────────────────────────────────────────────────────────────
// A file is a confirmed orphan once links_map has been populated for it AND the // A file is a confirmed orphan once links_map has been populated for it AND the
// links array is empty. links_map is a SvelteMap so this derived stays reactive. // links array is empty. links_map is a SvelteMap so this derived stays reactive.
@@ -356,6 +354,8 @@ let displayed_results = $derived(
orphan_filter ? results.filter((f) => orphan_ids.has(f.hosted_file_id)) : results orphan_filter ? results.filter((f) => orphan_ids.has(f.hosted_file_id)) : results
); );
let total_size = $derived(displayed_results.reduce((sum, f) => sum + (f.size ?? 0), 0));
async function check_all_for_orphans() { async function check_all_for_orphans() {
orphan_checking = true; orphan_checking = true;
orphan_filter = false; orphan_filter = false;