Skip to content

fix(sidebar): 修复 Windows 下隐藏仓库设置因存储 key 格式不一致而失效的问题#424

Closed
huazz233 wants to merge 2 commits into
J3n5en:mainfrom
huazz233:fix/sidebar-hidden-repo-key-mismatch
Closed

fix(sidebar): 修复 Windows 下隐藏仓库设置因存储 key 格式不一致而失效的问题#424
huazz233 wants to merge 2 commits into
J3n5en:mainfrom
huazz233:fix/sidebar-hidden-repo-key-mismatch

Conversation

@huazz233

Copy link
Copy Markdown
Contributor

Summary

  • saveRepositorySettings 使用 normalizeWorkspacePathKey(将 \ 转为 /),但 TreeSidebar 过滤隐藏仓库时使用 normalizePath(保留 \),导致 Windows 上存储 key 和查找 key 格式不一致,隐藏仓库设置永远匹配不上
  • TreeSidebar.tsx 中两处 normalizePath 改为 normalizeWorkspacePathKey,统一 key 格式

Root Cause

v0.2.39 的 remote workspace 重构 (#380) 将 getRepositorySettings / saveRepositorySettings 的 key 规范化从 normalizePath 改为 normalizeWorkspacePathKey,但 TreeSidebar 中的过滤逻辑未同步更新:

保存 key: normalizeWorkspacePathKey("D:\code\foo") → "d:/code/foo"
查找 key: normalizePath("D:\code\foo")             → "d:\code\foo"  ← 不匹配

Test plan

  • Windows 环境下,开启分组 → 右键隐藏仓库 → 验证仓库从侧边栏消失
  • 通过 RepositorySettingsDialog 隐藏仓库 → 关闭对话框 → 验证仓库隐藏生效
  • macOS / Linux 下隐藏仓库功能不受影响(这些平台 key 格式本身一致)

saveRepositorySettings 使用 normalizeWorkspacePathKey(反斜杠转正斜杠),
但 TreeSidebar 过滤时用 normalizePath(保留反斜杠),导致 Windows 上
key 永远匹配不上,隐藏设置形同虚设。统一使用 normalizeWorkspacePathKey。
@github-actions

Copy link
Copy Markdown
Contributor

Claude Code is working…

I'll analyze this and get back to you.

View job run

与 TreeSidebar (#404) 相同的 bug:handleMoveToGroup 改为按 id 匹配后,
RepositorySidebar 仍传入 menuRepo.path,导致分组移动静默失败。
同时补全本地 Repository 接口的 id 字段。
@github-actions

Copy link
Copy Markdown
Contributor

Claude Code is working…

I'll analyze this and get back to you.

View job run

@huazz233 huazz233 closed this Apr 15, 2026
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.

1 participant