From 4493501d10c6c0fc72f596b27e483240c469ddc0 Mon Sep 17 00:00:00 2001 From: npeter83 Date: Sat, 4 Jul 2026 05:30:43 +0200 Subject: [PATCH] fix(downloads): live-refresh the storage bar so a finished edit/download shows immediately MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 'Your storage' footprint used a one-shot query, refetched only at enqueue time — when the job is still queued (0 bytes) and the file lands asynchronously via the worker. So the footprint stayed stale (0 B) until a manual reload. Switch the UsageBar to useLiveQuery(2s), like the library list, so the footprint updates in lockstep the moment a clip/download completes (and after a delete). --- frontend/src/components/DownloadCenter.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/DownloadCenter.tsx b/frontend/src/components/DownloadCenter.tsx index bc29a71..2950b62 100644 --- a/frontend/src/components/DownloadCenter.tsx +++ b/frontend/src/components/DownloadCenter.tsx @@ -191,7 +191,10 @@ function RenameModal({ job, onClose }: { job: DownloadJob; onClose: () => void } function UsageBar() { const { t } = useTranslation(); - const usage = useQuery({ queryKey: ["download-usage"], queryFn: api.downloadUsage }); + // Poll live (like the library list) so the footprint updates the moment the worker finishes an + // edit/download — enqueue only creates a queued job (0 bytes), the size lands asynchronously, so + // a one-shot fetch at enqueue time would show a stale 0 B until a manual reload. + const usage = useLiveQuery(["download-usage"], api.downloadUsage, { intervalMs: 2000 }); const u = usage.data; if (!u) return null; const pct = u.unlimited || !u.max_bytes ? 0 : Math.min(100, (u.footprint_bytes / u.max_bytes) * 100);