Repository navigation
[codex] fix: chat home workspace switch delay on new task - #43
Merged
Merged
Conversation
ref 携带 homeWorkspaceExplicit 时同步定 homeWorkspaceHash,不再等 /api/workspaces 返回;home 模式 history 只认选中工作区 cwd, 无工作空间时显式清空残留输入历史。
shaohaozhi286
marked this pull request as ready for review
September 7, 2026 12:08
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.
背景
用户反馈:在项目上新建任务后,点击工具栏顶部的「新建任务」,聊天区的已选工作空间要 3-4 秒才能切换到「无工作空间」。
根因
ChatView 里聊天区空态的工作区相关控件(工作区选择显示、提交目标、斜杠命令工作区、输入历史)都派生自
homeWorkspaceHash/selectedHomeWorkspace,而这个状态只在GET /api/workspaces异步返回后才更新。点击「新建任务」时 ref 已同步切到无工作空间,但homeWorkspaceHash仍停留在上一个项目,直到列表请求回来(该请求在刚创建完会话的 daemon 上可能排队数秒)才切过去。修改
homeWorkspaceExplicit时,用ref.workspaceHash同步设置homeWorkspaceHash,不再等待工作区列表;异步加载后resolveHomeWorkspaceHash的 explicit 分支解析出相同值,不会闪回。影响
点击「新建任务」后,聊天区工作区显示、提交目标、命令工作区、专家列表、输入历史立即切换到无工作空间,消除 3-4 秒延迟。
验证