mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-20 23:04:06 +00:00
fix: sort queue jobs by create time (#8225)
Sort queue overlay ordering by create_time instead of priority so queued jobs keep their order when completions arrive. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-8225-fix-sort-queue-jobs-by-create-time-2ef6d73d3650815a8a81ec9d0b23a4e6) by [Unito](https://www.unito.io)
This commit is contained in:
@@ -197,13 +197,18 @@ export function useJobList() {
|
||||
const selectedWorkflowFilter = ref<'all' | 'current'>('all')
|
||||
const selectedSortMode = ref<JobSortMode>('mostRecent')
|
||||
|
||||
const mostRecentTimestamp = (task: TaskItemImpl) => task.createTime ?? 0
|
||||
|
||||
const allTasksSorted = computed<TaskItemImpl[]>(() => {
|
||||
const all = [
|
||||
...queueStore.pendingTasks,
|
||||
...queueStore.runningTasks,
|
||||
...queueStore.historyTasks
|
||||
]
|
||||
return all.sort((a, b) => b.queueIndex - a.queueIndex)
|
||||
return all.sort((a, b) => {
|
||||
const delta = mostRecentTimestamp(b) - mostRecentTimestamp(a)
|
||||
return delta === 0 ? 0 : delta
|
||||
})
|
||||
})
|
||||
|
||||
const tasksWithJobState = computed<TaskWithState[]>(() =>
|
||||
|
||||
Reference in New Issue
Block a user