Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

fix(models): Clear on an errored bundle survives a Models-tab remount

purplebbbf366b4021
diff --git a/src-tauri/src/commands/download.rs b/src-tauri/src/commands/download.rs
index 1f68c50f..cba569f6 100644
--- a/src-tauri/src/commands/download.rs
+++ b/src-tauri/src/commands/download.rs
@@ -392,14 +392,19 @@ pub fn cancel_download(id: String, state: State<'_, AppState>) -> Result<serde_j
}
}
- // If paused (no active token), clean up directly
- let was_paused = if let Ok(dl) = state.downloads.lock() {
- dl.get(&id).map(|p| p.status == "paused").unwrap_or(false)
+ // If paused or errored (no active token), clean up directly. Errored
+ // entries otherwise live in the map forever and resurrect the bundle
+ // card's error state on every Models-tab remount after the user hit
+ // Clear (the_mr_pickles) — refresh() re-reads this map on mount.
+ let cleanup_now = if let Ok(dl) = state.downloads.lock() {
+ dl.get(&id)
+ .map(|p| p.status == "paused" || p.status == "error")
+ .unwrap_or(false)
} else {
false
};
- if was_paused {
+ if cleanup_now {
// Remove from progress
if let Ok(mut dl) = state.downloads.lock() {
dl.remove(&id);
diff --git a/src/stores/downloadStore.ts b/src/stores/downloadStore.ts
index 50984c2f..13bc3035 100644
--- a/src/stores/downloadStore.ts
+++ b/src/stores/downloadStore.ts
@@ -161,6 +161,14 @@ export const useDownloadStore = create<DownloadStoreState>()((set, get) => ({
},
dismiss: (id: string) => {
+ // Errored entries also live in the Rust download map; drop them there
+ // too or the next refresh() (Models-tab remount) resurrects the error
+ // card the user just cleared (the_mr_pickles). Only for 'error' —
+ // cancelling an active transfer or a completed entry is not dismiss's
+ // job (the badge dismisses completed entries FE-only by design).
+ if (get().downloads[id]?.status === 'error') {
+ cancelDownload(id).catch(() => { /* app restart clears it anyway */ })
+ }
set(s => {
const updated = { ...s.downloads }
delete updated[id]