登录态恢复给服务器偏好读取加超时围栏

- AuthenticatedClient 的 hydrateClientServerSelection 改走 withAuthCheckTimeout,IPC 卡住时不再让界面无限停在「刷新登录状态」
This commit is contained in:
2026-10-06 18:51:16 +08:00
parent 9722b42692
commit e96d38a017
@@ -226,7 +226,13 @@ export function AuthenticatedClient({
try {
// 服务器选择先于认证读取落盘值:Rust 按 `expectedApiBaseUrl` 判定凭据归属,竞态下用
// 渠道默认值会被当成「凭据属于另一个 origin」而误报未登录,自定义服务器每次启动都要重登。
const selection = await hydrateClientServerSelection();
// 读服务器偏好同样是一次 IPC:不设围栏时,它卡住会让界面永远停在「刷新登录状态」,
// 既没有超时提示也没有重试路径(`hydrateClientServerSelection` 自己吞错、不会 reject)。
const selection = await withAuthCheckTimeout(
hydrateClientServerSelection(),
AUTH_CHECK_REQUEST_TIMEOUT_MS,
'读取服务器偏好超时,请重试或重启客户端',
);
if (!isActiveRun()) return;
setServerSelection(selection);
setCustomServerUrl(selection.customBaseUrl);