fix: clear stale download overlay after delete

Deleting a download removed the database row but left its entry in the
live-progress map, so the row kept showing Saved and an Offline badge
until the app restarted.
This commit is contained in:
vincent
2026-08-29 03:27:20 +02:00
parent d976d111bf
commit d0bad64d7c
2 changed files with 19 additions and 4 deletions
+3 -2
View File
@@ -73,7 +73,7 @@ export default function App() {
);
const { items, channels, loading, error, reload } = useFeed(filter);
const live = useDownloads(reload);
const { live, clear: clearLive } = useDownloads(reload);
useEffect(() => {
let un: (() => void) | undefined;
@@ -212,7 +212,7 @@ export default function App() {
cancelDownload(item.id).catch((e) => setFailure(String(e))),
onDelete: () =>
deleteDownload(item.id)
.then(() => { reload(); say("Download deleted"); })
.then(() => { clearLive(item.id); reload(); say("Download deleted"); })
.catch((e) => setFailure(String(e))),
};
return view === "grid" ? (
@@ -232,6 +232,7 @@ export default function App() {
onClose={() => setPlaying(null)}
onDelete={async () => {
await deleteDownload(playing.item.id);
clearLive(playing.item.id);
setPlaying(null);
reload();
say("Download deleted");