Skip to content

fix: 修复文件变更栏滚动、git diff 目录展开及工作区切换互串#584

Merged
phantom5099 merged 6 commits into1024XEngineer:mainfrom
Yumiue:html_progress
May 9, 2026
Merged

fix: 修复文件变更栏滚动、git diff 目录展开及工作区切换互串#584
phantom5099 merged 6 commits into1024XEngineer:mainfrom
Yumiue:html_progress

Conversation

@Yumiue
Copy link
Copy Markdown
Collaborator

@Yumiue Yumiue commented May 9, 2026

Summary

  • 修复文件变更面板中 hunk 内部滚动阻止外层列表滚动的问题
  • 修复 git diff 将未跟踪目录当作文件处理导致预览失败的问题
  • 修复切换工作区后文件树与时间文案错乱的问题

修复详情

1. 文件变更栏滚动卡住 (FileChangePanel)

hunk 区域 overflowY: visible 会将纵向滚轮事件吞掉,导致鼠标悬停在 diff 上时外层列表无法滚动。改为 overflowY: hidden,并在 hunk 上显式 onWheel 转发给外层 scrollContainer。同时用 flexShrink: 0 防止 change card 被 flex 压缩,viewContainerflex: 1 替代固定高度确保撑满。

2. git diff 将目录当作文件处理 (git_diff / git)

git status 返回未跟踪目录条目(如 ?? handwrite_res/)时,后端直接把目录当成文件,导致预览打开报错。在 loadGitSnapshot 中增加未跟踪目录展开逻辑,递归列出目录内的实际文件,同时遵循 gitignore 规则过滤。ReadGitDiffFile 遇到目录路径时返回明确的 "is a directory" 错误语义。

3. 工作区切换互串 + 时间乱码 (FileTreePanel / format)

切换工作区后异步请求响应乱序到达,旧工作区的数据覆盖了新工作区的文件树。用 requestToken 计数 + activeWorkspaceRef + mountedRef 三重校验丢弃过期响应,loadDir 同步防护。FileTreePanelkey={workspaceHash} 兜底强制重建。

relativeTime 中 "刚刚" 文案编码损坏导致乱码,同时统一缩进风格。

4.修复neocode web的启动失败问题

现在发布版本,CI会自动内嵌dist使得用户构建包版本不会npm缺失报错

5.文件变更栏美化

现在变得更好看了

Test plan

  • 文件变更面板:展开多个文件后鼠标滚轮可正常滚动整个列表
  • Git Diff 面板:未跟踪目录内的文件可正常预览
  • 切换工作区后文件树立即展示对应工作区内容
  • 工作区快速切换时不会闪现旧工作区文件

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@fennoai
Copy link
Copy Markdown

fennoai Bot commented May 9, 2026

I found 2 noteworthy issues after the code quality, performance, security, and documentation passes.

  1. Medium — web/src/components/panels/FileTreePanel.tsx: openFilePreview still applies readFile results without checking that the active workspace is unchanged. If a user opens the same path in workspace A and workspace B around a switch, the late response from A can still populate the B tab because the tab id is path-based (file:${path}). loadRoot/loadDir now guard against stale workspace responses; this path needs the same protection.

  2. Medium — internal/repository/git.go: untracked-directory expansion now recursively walks every untracked subtree inside loadGitSnapshot. That makes summary / changed-files / diff reads proportional to directory size, and even ReadGitDiffFile for one path pays for a full walk first because it calls loadGitSnapshot. On large generated folders this is a noticeable regression; consider a git-based listing or a capped/lazy expansion.

No additional security or documentation-specific findings.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 9, 2026

Codecov Report

❌ Patch coverage is 58.58586% with 41 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/cli/web_command.go 38.70% 19 Missing ⚠️
internal/repository/git.go 66.66% 12 Missing and 6 partials ⚠️
internal/repository/git_diff.go 63.63% 2 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

@phantom5099 phantom5099 merged commit 4895d04 into 1024XEngineer:main May 9, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants