From 79a6421329661b7c9edeba633fcd562057eaa7ee Mon Sep 17 00:00:00 2001 From: Benjamin Lu Date: Mon, 8 Dec 2025 23:59:43 -0800 Subject: [PATCH] Fix cloud queue cancel to target specific jobs (#7176) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary - switch QueueProgressOverlay cancel action to target explicit prompt ids on cloud via /api/queue delete - keep non-cloud behavior using /interrupt for local installs - ensure prompt id list generation is straightforward ## Testing - pnpm typecheck - pnpm lint:fix ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-7176-Fix-cloud-queue-cancel-to-target-specific-jobs-2c06d73d365081b38ab2f81d71f62186) by [Unito](https://www.unito.io) --- src/components/queue/QueueProgressOverlay.vue | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/components/queue/QueueProgressOverlay.vue b/src/components/queue/QueueProgressOverlay.vue index cf4d88fba..a941af55a 100644 --- a/src/components/queue/QueueProgressOverlay.vue +++ b/src/components/queue/QueueProgressOverlay.vue @@ -75,6 +75,7 @@ import { useQueueProgress } from '@/composables/queue/useQueueProgress' import { useResultGallery } from '@/composables/queue/useResultGallery' import { useErrorHandling } from '@/composables/useErrorHandling' import { useAssetSelectionStore } from '@/platform/assets/composables/useAssetSelectionStore' +import { isCloud } from '@/platform/distribution/types' import { api } from '@/scripts/api' import { useAssetsStore } from '@/stores/assetsStore' import { useCommandStore } from '@/stores/commandStore' @@ -263,11 +264,21 @@ const cancelQueuedWorkflows = wrapWithErrorHandlingAsync(async () => { const interruptAll = wrapWithErrorHandlingAsync(async () => { const tasks = queueStore.runningTasks - await Promise.all( - tasks - .filter((task) => task.promptId != null) - .map((task) => api.interrupt(task.promptId)) - ) + const promptIds = tasks + .map((task) => task.promptId) + .filter((id): id is string => typeof id === 'string' && id.length > 0) + + if (!promptIds.length) return + + // Cloud backend supports cancelling specific jobs via /queue delete, + // while /interrupt always targets the "first" job. Use the targeted API + // on cloud to ensure we cancel the workflow the user clicked. + if (isCloud) { + await Promise.all(promptIds.map((id) => api.deleteItem('queue', id))) + return + } + + await Promise.all(promptIds.map((id) => api.interrupt(id))) }) const showClearHistoryDialog = () => {