-
-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Description
问题描述
在桌面端使用 Connect Phone 成功连接手机后,只要把二维码弹窗关闭(点击遮罩或按 Esc),手机端会话会立即断开。
当前行为把“关闭弹窗(UI)”和“断开远程访问(业务)”绑定在一起,导致无法在后台继续使用手机端会话。
复现步骤
- 打开应用,点击侧边栏
Connect Phone。 - 用手机扫描二维码并进入远程页面。
- 确认页面显示已连接(例如
1 client(s) connected)。 - 在电脑端关闭二维码弹窗(点击弹窗外遮罩或按
Esc)。
实际结果
手机端 WebSocket 连接断开,远程会话中止。
期望结果
关闭二维码弹窗只应关闭 UI,不应停止 remote server;
应由显式动作(如 Disconnect 按钮或侧边栏 Disconnect Phone)来停止远程服务。
根因定位(代码)
1) 关闭弹窗会调用 closeAndStop(),内部直接 stopRemoteAccess()
src/components/ConnectPhoneModal.tsx:39-46
async function closeAndStop(): Promise<void> {
stopPolling?.();
if (store.remoteAccess.enabled) {
await stopRemoteAccess();
}
setQrDataUrl(null);
props.onClose();
}2) 遮罩点击与 Esc 都走 closeAndStop()
src/components/ConnectPhoneModal.tsx:77-79src/components/ConnectPhoneModal.tsx:152
3) stopRemoteAccess() 会触发 IPC.StopRemoteServer
src/store/remote.ts:44-47
4) 主进程收到 StopRemoteServer 会执行 remoteServer.stop()
electron/ipc/register.ts中IPC.StopRemoteServerhandler
备注
当前文案已体现该行为("Closing this dialog will disconnect remote access."),但从使用体验看,这会导致用户无法在关闭二维码窗口后继续使用手机端会话。建议把“关闭弹窗”和“断开连接”解耦。
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels