perf(desktop): virtualize history session list#3990
Open
GTC2080 wants to merge 3 commits into
Open
Conversation
SivanCola
requested changes
Jun 12, 2026
SivanCola
left a comment
Collaborator
There was a problem hiding this comment.
这个拆分方向是对的,scope 也符合 #3989;CI 目前也是绿的。不过合并前请先整改下面两个问题:
-
VirtualList需要把稳定 row key 传给useVirtualizer的getItemKey。现在getKey只用于 React key,TanStack virtualizer 内部仍然默认按 index 缓存测量结果。History/Trash 这里是 group 行和 session 行混排,过滤或日期分组变化后,同一个 index 可能换成不同高度的行,容易留下旧测量,影响总高度和scrollToIndex定位。 -
虚拟行间距在主题样式下会被覆盖。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。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
VirtualListwrapper around the existing@tanstack/react-virtualdependency.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 modulecd desktop/frontend && npm run typecheckcd desktop/frontend && npm run buildcd desktop/frontend && npm run test:allhttp://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/frontendrendering code.