From a0d66bb0d763e721452a8071f73ad204f55417f7 Mon Sep 17 00:00:00 2001 From: Jennifer Weber Date: Fri, 15 Aug 2025 20:45:45 -0700 Subject: [PATCH] Fix for depulicating tasks in queuestore by promptId to take into account sorting differences --- src/stores/queueStore.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/stores/queueStore.ts b/src/stores/queueStore.ts index 34856b8d6..62273a566 100644 --- a/src/stores/queueStore.ts +++ b/src/stores/queueStore.ts @@ -479,13 +479,22 @@ export const useQueueStore = defineStore('queue', () => { const existingHistoryItems = historyTasks.value.filter((item) => allIndex.has(item.queueIndex) ) - historyTasks.value = [...newHistoryItems, ...existingHistoryItems] + const sortedTasks = [...newHistoryItems, ...existingHistoryItems] .slice(0, maxHistoryItems.value) .sort((a, b) => { const aTime = a.executionStartTimestamp ?? 0 const bTime = b.executionStartTimestamp ?? 0 return bTime - aTime }) + const foundPromptIds = new Set() + const deduplicatedTasks = sortedTasks.filter((item) => { + if (!foundPromptIds.has(item.promptId)) { + foundPromptIds.add(item.promptId) + return true + } + return false + }) + historyTasks.value = deduplicatedTasks } finally { isLoading.value = false }