fix(duplicates): close three more P2 correctness issues from review

- commands: delete_images_from_disk now returns Vec<i64> of IDs that
  were actually removed from disk rather than a bare count, so callers
  can act precisely on what succeeded vs. what failed

- store: deleteSelectedDuplicates uses the returned ID set to filter
  duplicate groups (files that failed to delete stay visible for retry)
  and invalidates both the global "all" cache and each affected folder
  cache, not just the currently-viewed scope

- Lightbox: guard the getImageTags effect with a cancellation flag so
  a response that arrives after the user has navigated to another image
  cannot overwrite the new image's tag list
This commit is contained in:
2026-06-07 23:02:51 +01:00
parent ae3d6e1034
commit 1f6650021c
3 changed files with 30 additions and 13 deletions
+4 -4
View File
@@ -1153,9 +1153,9 @@ pub async fn invalidate_duplicate_scan_cache(
pub async fn delete_images_from_disk(
db: State<'_, DbState>,
params: DeleteImagesFromDiskParams,
) -> Result<usize, String> {
) -> Result<Vec<i64>, String> {
if params.image_ids.is_empty() {
return Ok(0);
return Ok(Vec::new());
}
let conn = db.get().map_err(|e| e.to_string())?;
let records = db::get_all_image_paths(&conn, None).map_err(|e| e.to_string())?;
@@ -1170,11 +1170,11 @@ pub async fn delete_images_from_disk(
succeeded_ids.push(r.id);
}
}
let deleted = succeeded_ids.len();
if !succeeded_ids.is_empty() {
db::delete_images_by_ids(&conn, &succeeded_ids).map_err(|e| e.to_string())?;
}
Ok(deleted)
// Return the IDs that were actually removed so the caller can update state precisely.
Ok(succeeded_ids)
}
#[tauri::command]