From 5f599a99808d4ae528603db5f274abfb6b466764 Mon Sep 17 00:00:00 2001 From: Tiberiu Ichim Date: Sat, 14 Feb 2026 22:03:02 +0200 Subject: [PATCH] Improve consolidate behavior: redirect to book page and prevent library page redirects for same-library moves --- client/components/app/Appbar.vue | 3 +++ client/components/cards/LazyBookCard.vue | 1 + server/controllers/LibraryItemController.js | 14 +++++++++----- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/client/components/app/Appbar.vue b/client/components/app/Appbar.vue index f2a949ee0..0d2e6bad0 100644 --- a/client/components/app/Appbar.vue +++ b/client/components/app/Appbar.vue @@ -275,6 +275,9 @@ export default { }) .then((data) => { this.$toast.success(this.$strings.ToastBatchConsolidateSuccess) + if (this.numMediaItemsSelected === 1) { + this.$router.push(`/item/${this.selectedMediaItems[0].id}`) + } this.cancelSelectionMode() }) .catch((error) => { diff --git a/client/components/cards/LazyBookCard.vue b/client/components/cards/LazyBookCard.vue index d54bc6e3e..1703833d2 100644 --- a/client/components/cards/LazyBookCard.vue +++ b/client/components/cards/LazyBookCard.vue @@ -816,6 +816,7 @@ export default { .$post(`/api/items/${this.libraryItemId}/consolidate`) .then(() => { this.$toast.success(this.$strings.ToastConsolidateSuccess || 'Consolidate successful') + this.$router.push(`/item/${this.libraryItemId}`) }) .catch((error) => { console.error('Failed to consolidate', error) diff --git a/server/controllers/LibraryItemController.js b/server/controllers/LibraryItemController.js index c1ae5c5eb..aa581f2b5 100644 --- a/server/controllers/LibraryItemController.js +++ b/server/controllers/LibraryItemController.js @@ -249,11 +249,15 @@ async function handleMoveLibraryItem(libraryItem, targetLibrary, targetFolder, n } // Emit socket events for UI updates - SocketAuthority.emitter('item_removed', { - id: libraryItem.id, - libraryId: oldLibraryId - }) - SocketAuthority.libraryItemEmitter('item_added', libraryItem) + if (oldLibraryId !== targetLibrary.id) { + SocketAuthority.emitter('item_removed', { + id: libraryItem.id, + libraryId: oldLibraryId + }) + SocketAuthority.libraryItemEmitter('item_added', libraryItem) + } else { + SocketAuthority.libraryItemEmitter('item_updated', libraryItem) + } Logger.info(`[LibraryItemController] Successfully moved item "${libraryItem.media.title}" to library "${targetLibrary.name}"`) } catch (error) {