Skip to content

perf(desktop): virtualize history session list#3990

Open
GTC2080 wants to merge 3 commits into
esengine:main-v2from
GTC2080:GTC/desktop-history-virtual-list
Open

perf(desktop): virtualize history session list#3990
GTC2080 wants to merge 3 commits into
esengine:main-v2from
GTC2080:GTC/desktop-history-virtual-list

Conversation

@GTC2080

@GTC2080 GTC2080 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add a small reusable VirtualList wrapper around the existing @tanstack/react-virtual dependency.
  • Flatten the History/Trash modal session list into virtual rows for day headings and saved sessions.
  • Preserve the existing modal layout, filters, preview pane, row actions, selection treatment, and theme identity.

Closes #3989.
Refs #3816.

Scope notes

This is intentionally only the owner-requested standalone virtualization split from #3816. It does not touch the #3805 desktop refresh direction, AppChrome, CommandPalette, ContextPanel, accent identity, or the terminal dock.

Validation

  • cd desktop && wails generate module
  • cd desktop/frontend && npm run typecheck
  • cd desktop/frontend && npm run build
  • cd desktop/frontend && npm run test:all
  • Browser smoke: Vite dev server at http://127.0.0.1:5174/?platform=windows, opened the History modal and confirmed virtualized rendering path: virtualLists=1, renderedRows=7, renderedSessions=4, historyListHeight=522, virtualHeight=498, hasPreview=true.

Go validation note

cd desktop && go test ./... still hits two existing Windows/local-environment failures that reproduce when rerun individually:

  • TestUpdateMCPServerSplitsPastedCommandLine: temp dir cleanup cannot remove a locked file.
  • TestAddSkillPathRestoresConventionRootWithoutCustomPath: local excluded skill path state includes ~/.agents/skills.

This PR only changes desktop/frontend rendering code.

@github-actions github-actions Bot added v2 Go rewrite (1.x) — main-v2 branch, active development desktop Wails desktop app (desktop/**) labels Jun 11, 2026

@SivanCola SivanCola left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

这个拆分方向是对的,scope 也符合 #3989;CI 目前也是绿的。不过合并前请先整改下面两个问题:

  1. VirtualList 需要把稳定 row key 传给 useVirtualizergetItemKey。现在 getKey 只用于 React key,TanStack virtualizer 内部仍然默认按 index 缓存测量结果。History/Trash 这里是 group 行和 session 行混排,过滤或日期分组变化后,同一个 index 可能换成不同高度的行,容易留下旧测量,影响总高度和 scrollToIndex 定位。

  2. 虚拟行间距在主题样式下会被覆盖。PR 新增了 .history-virtual-row .hist-item { margin-bottom: 0; },但后面的 :root[data-theme-style] .hist-item { margin-bottom: 6px; } 权重更高,而且 applyTheme 会始终设置 data-theme-style。结果 session 行会同时有 wrapper 的 padding-bottom: 6px 和 item 的 margin-bottom: 6px,虚拟行高度/滚动估算会偏掉。请补一个 theme-aware override,或者把虚拟化专用 spacing 规则放到主题覆盖之后。

这两点修完并保留 frontend checks/browser smoke 通过后,我会继续 merge。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

desktop Wails desktop app (desktop/**) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[desktop] Virtualize long History/Trash session lists

2 participants