From 49a5e26155337c0870b09cf747d21f2034169706 Mon Sep 17 00:00:00 2001
From: ThaUnknown <6506529+ThaUnknown@users.noreply.github.com>
Date: Mon, 13 Oct 2025 17:32:22 +0200
Subject: [PATCH] feat: add confirmation dialog for library deletions fix:
entries not being deselected after deletion [yikes!!!!]
---
package.json | 2 +-
.../ui/torrentclient/library/table.svelte | 43 ++++++++++++++++---
2 files changed, 37 insertions(+), 8 deletions(-)
diff --git a/package.json b/package.json
index 9da4a81..6f5eeaf 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "ui",
- "version": "6.4.154",
+ "version": "6.4.155",
"license": "BUSL-1.1",
"private": true,
"packageManager": "pnpm@9.15.5",
diff --git a/src/lib/components/ui/torrentclient/library/table.svelte b/src/lib/components/ui/torrentclient/library/table.svelte
index 6299435..ce0941d 100644
--- a/src/lib/components/ui/torrentclient/library/table.svelte
+++ b/src/lib/components/ui/torrentclient/library/table.svelte
@@ -13,6 +13,7 @@
import { goto } from '$app/navigation'
import { FolderSync, Trash } from '$lib/components/icons/animated'
+ import * as Dialog from '$lib/components/ui/dialog'
import { Input } from '$lib/components/ui/input'
import * as Table from '$lib/components/ui/table'
import { client } from '$lib/modules/anilist'
@@ -115,11 +116,11 @@
const { selectedDataIds, someRowsSelected } = pluginStates.select
function getSelected () {
- return Object.keys($selectedDataIds).map(id => $lib[id as unknown as number]?.hash).filter(e => e) as string[]
+ return Object.keys($selectedDataIds).map(id => $lib[id as unknown as number]).filter(e => e) as LibraryEntry[]
}
function rescanTorrents () {
- toast.promise(native.rescanTorrents(getSelected()), {
+ toast.promise(native.rescanTorrents(getSelected().map(e => e.hash)), {
loading: 'Rescanning torrents...',
success: 'Rescan complete',
error: e => {
@@ -129,11 +130,12 @@
description: 'This may take a VERY long while depending on the number of torrents.'
})
}
+
function deleteTorrents () {
toast.promise(
- native.deleteTorrents(getSelected())
+ native.deleteTorrents(getSelected().map(e => e.hash))
.then(() => server.updateLibrary()
- .then(() => pluginStates.select.allPageRowsSelected.set(false))
+ .then(() => pluginStates.select.selectedDataIds.clear())
), {
loading: 'Deleting torrents...',
success: 'Torrents deleted',
@@ -160,9 +162,36 @@
-
+
+ {#each getSelected() as entry (entry.hash)}
+
+