mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 06:20:11 +00:00
## Summary Virtualize the shared job queue history list so opening the jobs panel does not eagerly mount the full history on cloud. ## Changes - **What**: Virtualize the shared queue history list used by the overlay and sidebar, flatten date headers plus job rows into a single virtual stream, and preserve hover/menu behavior with updated queue list tests. - **Why `@tanstack/vue-virtual` instead of Reka virtualizers**: the installed `reka-ui@2.5.0` does not expose a generic list virtualizer. It only exposes `ListboxVirtualizer`, `ComboboxVirtualizer`, and `TreeVirtualizer`, and those components inject `ListboxRoot`/`TreeRoot` context and carry listbox or tree selection/keyboard semantics. The job history UI is a flat grouped action list, not a selectable listbox or navigable tree, so this uses the same TanStack virtualizer layer directly without forcing the wrong semantics onto the component. ## Review Focus Please verify the virtual row sizing and inter-group spacing behavior across date headers and the last row in each group. > [!TIP] > Diff reads much cleaner through vscode's unified view with show leading/trailing whitespace differences enabled Linear: COM-304 https://tanstack.com/virtual/latest/docs/api/virtualizer ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-10592-fix-virtualize-cloud-job-queue-history-list-3306d73d3650819d956bf4b2d8b59a40) by [Unito](https://www.unito.io)
38 lines
676 B
TypeScript
38 lines
676 B
TypeScript
import type { JobGroup, JobListItem } from '@/composables/queue/useJobList'
|
|
|
|
export type VirtualJobRow =
|
|
| {
|
|
key: string
|
|
type: 'header'
|
|
label: string
|
|
}
|
|
| {
|
|
key: string
|
|
type: 'job'
|
|
job: JobListItem
|
|
}
|
|
|
|
export function buildVirtualJobRows(
|
|
displayedJobGroups: JobGroup[]
|
|
): VirtualJobRow[] {
|
|
const rows: VirtualJobRow[] = []
|
|
|
|
displayedJobGroups.forEach((group) => {
|
|
rows.push({
|
|
key: `header-${group.key}`,
|
|
type: 'header',
|
|
label: group.label
|
|
})
|
|
|
|
group.items.forEach((job) => {
|
|
rows.push({
|
|
key: `job-${job.id}`,
|
|
type: 'job',
|
|
job
|
|
})
|
|
})
|
|
})
|
|
|
|
return rows
|
|
}
|