From 105e2978965983784a20e8272f22344626185442 Mon Sep 17 00:00:00 2001 From: Gab4545 Date: Wed, 18 Mar 2026 16:28:24 +0100 Subject: [PATCH] fix(dashboard): filter ghost downloads and force UI cleanup on kill command --- app/dashboard/page.tsx | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/app/dashboard/page.tsx b/app/dashboard/page.tsx index 533dc3f..18ed897 100644 --- a/app/dashboard/page.tsx +++ b/app/dashboard/page.tsx @@ -623,6 +623,9 @@ function RealDashboard() { saveCacheToLocalStorage() } + setDownloads(prev => prev.filter(d => d.id !== id)) + previousDownloadsRef.current.delete(id) + toast({ title: 'Kill Command Sent', description: 'Download will be removed shortly', @@ -679,12 +682,21 @@ function RealDashboard() { router.push('/') } - const activeDownloads = downloads.filter(d => + // Filter ghost downloads + const validDownloads = downloads.filter(d => { + const isGhost = d.progress === 0 && + (d.downloaded === '0 B' || d.downloaded === '0') && + ['paused', 'stopped', 'error'].includes(d.status); + + return !isGhost; // Kepp only real downloads + }); + + const activeDownloads = validDownloads.filter(d => d.status === 'downloading' || d.status === 'queued' || d.status === 'extracting' ) - const pausedDownloads = downloads.filter(d => d.status === 'paused' || d.status === 'stopped') - const completedDownloads = downloads.filter(d => d.status === 'completed') - const errorDownloads = downloads.filter(d => d.status === 'error') + const pausedDownloads = validDownloads.filter(d => d.status === 'paused' || d.status === 'stopped') + const completedDownloads = validDownloads.filter(d => d.status === 'completed') + const errorDownloads = validDownloads.filter(d => d.status === 'error') return ( <>