Repository navigation
fix(home): 连接快速打开点一次不再新建两个会话(#461) - #462
Merged
Merged
Conversation
连接快速打开对话框的列表行自己挂了 on_click 打开连接,而 List 内建的 行点击处理也会走 set_selected_index → confirm,confirm 里同样打开一次。 一次鼠标点击先后触发这两条路径,于是同一台服务器被连开两个 SSH 会话 (已有 2 个标签时点「+」新建,直接变成 4 个)。 现在删掉行内的打开回调(以及只被它使用的绑定),点击和键盘回车统一只走 confirm;同时补一条源码级回归测试,锁住「行渲染不得直接打开连接」。
feigeCode
added a commit
that referenced
this pull request
Oct 25, 2026
把 origin/dev(15e41c0f7,62 个提交)合进本分支,带进: - 快捷打开一次建两个 SSH 会话的修复(#461/#462) - 个人同步导出凭据引用归一化、git 同步冲突「应用」修复 - 跨块拖选覆盖表格/分隔线的高亮、PostgreSQL 字符列默认值补引号 - 连接级 AI 访问策略(migration 20261022000001_connection_ai_access) - v0.21.1 发布与 changelog 更新 冲突只三处,解法: - AGENTS.md:两侧都是纯新增,取并集(本分支 6 条经验 + dev 的 GUI spawn npx 一条) - crates/ai_chat_view/locales/ai_chat_view.yml:保留 search_branch / search_model, dev 的 search_models 随其手写模型搜索框一并弃用 - crates/ai_chat_view/src/input/agent_input.rs:模型下拉保留本分支的组件库 Select (自带搜索框、虚拟滚动、键盘导航,是 dev 手写 Popover+搜索框的超集),删掉 dev 侧的 model_search_input/model_search_needs_reset、MODEL_MENU_* 常量、 filter_model_options/model_option_matches 及其单测
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.
问题
关联 #461。
在标签栏点「+」打开「打开连接」对话框,选中一台服务器点击一行后,一次点击会新建 两个 SSH 会话(已有 2 个标签时点一次变成 4 个)。
根因
ConnectionQuickOpenDelegate::render_item给行ListItem挂了on_click打开连接;而 gpui-component 的List在render_list_item里给外层行容器注册了内建点击处理:confirm里又打开了一次连接。gpui 的鼠标事件在 bubble 阶段按注册逆序逐个触发命中的 listener,只有stop_propagation()才中断,因此同一次鼠标抬起同时触发了行内on_click与confirm,创建两条ssh-terminal-*标签。window.close_dialog只改 Root 状态、不会重建当次 dispatch 的 listener 表,拦不住第二次打开。修复
render_item中行的打开回调,以及只被它使用的parent/connection_for_open绑定;行点击与键盘回车统一只走confirm一条路径。quick_open_rows_open_connections_only_through_confirm:断言行渲染路径不得出现open_connection_from_quick,且confirm必须仍然打开连接。行内「保存为连接」按钮的
stop_propagation()保持不变。验证
cargo test -p main quick_open→ 5 passed; 0 failed(含新增回归测试)rustfmt --edition 2024 --check main/src/home/home_connection_quick_open.rs→ 通过