PERF: make the chat sidebar linear and virtualized for large chat collections #18
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nsaspy/a0-symbolics#18
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Finding
The current chat sidebar does repeated whole-collection scans/sorts from Alpine bindings. With hundreds or thousands of chats this turns one reactive render into quadratic-style work and mounts every visible row into the DOM.
Hot paths:
webui/components/sidebar/chats/chats-store.jsapplyContexts()filters + sorts the entire incoming list every snapshot.topLevelContexts()filters the whole list and then calls extension sorting.childContexts(parentId)filters the whole list and then calls extension sorting.hasChildren(parentId)callschildContexts(parentId).setSelected,contains, delete/rollback paths repeatedly usefind/somescans.webui/components/sidebar/chats/chats-list.htmltopLevelContexts()repeatedly inx-show,x-for, and divider bindings.hasChildren(context.id)multiple times.childContexts(context.id)again forx-forand again for divider calculation.webui/components/sidebar/sidebar-store.jssortRows()clones the complete row list before every extension sort pass.hasRowDividerBefore()invokes every divider extension for every rendered row and receives the complete row array.The message timeline already has a bounded render window; this issue is specifically the chat collection navigator/sidebar, which does not.
Direction
Build a derived chat index once per roster version rather than recomputing it from template expressions:
id -> contextmapparent_id -> ordered child IDsDo not solve this by removing plugin row customization. Move plugin sorting/grouping/divider/decorator semantics to an indexed/materialized pipeline with explicit invalidation.
Acceptance
hasChildren, ID lookup, and child lookup are O(1) / proportional to that parent's child count.