Skip to content

Conversation

csehatt741
Copy link
Contributor

@csehatt741 csehatt741 commented Aug 27, 2025

Summary

A new feature was implemented to reverse queue list and virtualize the queue list

  • a type, QUEUE_ORDER_BY, was created in session_queue_common.py to represent allowed sort columns
  • a new abstract method, get_queue_itemIds, was created in SessionQueueBase for acquiring all queue item IDs
  • a new method, get_queue_itemIds, was created in SqliteSessionQueue for acquiring all queue item IDs
  • new endpoints, get_queue_item_ids and get_queue_items_by_item_ids, were created in session_queue_router to expose the functionality of acquiring all queue item IDs and getting queue items by item IDs
  • QueueItemComponent changes:
    • completedAt field was added, while batchFieldValues field was removed to adhere to new requirements
    • QueueItemPlaceholder component was added to provide a placeholder icon while the queue item is being loaded
  • QueueList component was refactored to virtualize item loading
  • QueueListHeaderColumn component was created to encapsulate sort related logic and components
  • QueueListHeader component was refactored to use QueueListHeaderColumn components
  • new custom hooks, useQueueItemIds, useScrollableQueueList and useRangeBasedQueueItemFetching, were created to virtualize the queue list
  • new fields, sortBy and sortOrder, were added to queueSlice.ts to represent and persist sort related data
  • new endpoints, getQueueItemIds and getQueueItemDTOsByItemIds, were added to queue.ts to expose virtualization related API endpoints
  • schema.ts was generated to include new virtualization related endpoints
  • new tanslations, queue.completedAt, queue.sortColumn, queue.sortBy, queue.sortOrderAscending and queue.sortOrderDescending, were added to en.json

Related Issues / Discussions

Closes #1234" format, so that the issue will be automatically closed when the PR merges.-->

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • Documentation added / updated (if applicable)
  • Updated What's New copy (if doing a release after this PR)

@github-actions github-actions bot added frontend PRs that change frontend files api python PRs that change python files services PRs that change app services labels Aug 27, 2025
@csehatt741 csehatt741 force-pushed the feat/reverse-queue-list branch from 3f0c3b8 to 10e1b09 Compare August 29, 2025 08:10
@csehatt741
Copy link
Contributor Author

Some comments on the PR:

  • I did not find a good reason for sorting on #, which would introduce some more complexity to the implementation, so I left it out
  • when queue list content is reloaded the whole list blinks, while when items are served from cache everything is smooth
  • a different image/animation might be better for the placeholder

@csehatt741 csehatt741 marked this pull request as ready for review August 29, 2025 08:57
@csehatt741 csehatt741 force-pushed the feat/reverse-queue-list branch 3 times, most recently from 1732c30 to c670aa7 Compare September 3, 2025 04:59
@csehatt741
Copy link
Contributor Author

@psychedelicious, I expect now listQueueItems and listAllQueueItems endpoints are redundant and it is safe to remove them.

@csehatt741
Copy link
Contributor Author

csehatt741 commented Sep 3, 2025

There are issues with sorting on the status column:

  • in the UI language dependent labels are displayed, while sorting actually happens in the database on values in English. Quite likely there is a mismatch between the order of language dependent labels and the actual sorting.
  • when the status of a queue item changes, eg. cancelled, the whole getQueueItemIds needs to be invalidated, as the order of the list changes

@psychedelicious
Copy link
Collaborator

There are issues with sorting on the status column:

* in the UI language dependent labels are displayed, while sorting actually happens in the database on values in English. Quite likely there is a mismatch between the order of language dependent labels and the actual sorting.

* when the status of a queue item changes, eg. cancelled, the whole `getQueueItemIds` needs to be invalidated, as the order of the list changes

Ah, dang. We could fix the sorting such that we sort by the meaning of the status (i.e. pending, in progress, completed, failed, canceled) but the invalidation aspect is tricky. Let's make that column not sortable for now.

@csehatt741
Copy link
Contributor Author

@psychedelicious, I expect now listQueueItems and listAllQueueItems endpoints are redundant and it is safe to remove them.

@psychedelicious, how about listQueueItems and listAllQueueItems endpoints? Can we get rid of them now?

@psychedelicious
Copy link
Collaborator

@psychedelicious, I expect now listQueueItems and listAllQueueItems endpoints are redundant and it is safe to remove them.

@psychedelicious, how about listQueueItems and listAllQueueItems endpoints? Can we get rid of them now?

I believe listQueueItems can go, but listAllQueueItems is used by Canvas.

@csehatt741
Copy link
Contributor Author

csehatt741 commented Sep 4, 2025

@psychedelicious, I expect now listQueueItems and listAllQueueItems endpoints are redundant and it is safe to remove them.

@psychedelicious, how about listQueueItems and listAllQueueItems endpoints? Can we get rid of them now?

I believe listQueueItems can go, but listAllQueueItems is used by Canvas.

How about listCursor and listPriority in queueSlice? Though, events are dispatched, but values seem not to be read.

@psychedelicious
Copy link
Collaborator

@psychedelicious, I expect now listQueueItems and listAllQueueItems endpoints are redundant and it is safe to remove them.

@psychedelicious, how about listQueueItems and listAllQueueItems endpoints? Can we get rid of them now?

I believe listQueueItems can go, but listAllQueueItems is used by Canvas.

How about listCursor and listPriority in queueSlice? Though, events are dispatched, but values seem not to be read.

It looks like the whole slice can go now! The only other two things in it are selectedQueueItem and resumeProcessorOnEnqueue and I don't se any references to these anywhere.

@csehatt741 csehatt741 force-pushed the feat/reverse-queue-list branch from 1244e5a to 7287197 Compare September 4, 2025 08:18
@csehatt741
Copy link
Contributor Author

There are issues with sorting on the status column:

* in the UI language dependent labels are displayed, while sorting actually happens in the database on values in English. Quite likely there is a mismatch between the order of language dependent labels and the actual sorting.

* when the status of a queue item changes, eg. cancelled, the whole `getQueueItemIds` needs to be invalidated, as the order of the list changes

Ah, dang. We could fix the sorting such that we sort by the meaning of the status (i.e. pending, in progress, completed, failed, canceled) but the invalidation aspect is tricky. Let's make that column not sortable for now.

status column removed

@csehatt741
Copy link
Contributor Author

@psychedelicious, I expect now listQueueItems and listAllQueueItems endpoints are redundant and it is safe to remove them.

@psychedelicious, how about listQueueItems and listAllQueueItems endpoints? Can we get rid of them now?

I believe listQueueItems can go, but listAllQueueItems is used by Canvas.

How about listCursor and listPriority in queueSlice? Though, events are dispatched, but values seem not to be read.

It looks like the whole slice can go now! The only other two things in it are selectedQueueItem and resumeProcessorOnEnqueue and I don't se any references to these anywhere.

  • listQueueItems endpoint removed
  • queueSlice cleaned up

Copy link
Collaborator

@psychedelicious psychedelicious left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, thanks!

@psychedelicious psychedelicious enabled auto-merge (rebase) September 5, 2025 02:25
@csehatt741 csehatt741 force-pushed the feat/reverse-queue-list branch from 70e124d to d2dab99 Compare September 5, 2025 11:07
@psychedelicious psychedelicious enabled auto-merge (rebase) September 8, 2025 10:32
@psychedelicious psychedelicious merged commit 22b038c into invoke-ai:main Sep 8, 2025
13 checks passed
@csehatt741 csehatt741 deleted the feat/reverse-queue-list branch September 8, 2025 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api frontend PRs that change frontend files python PRs that change python files services PRs that change app services
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[enhancement]: Reverse the queue list - Latest entry should be at the top
2 participants