perf(bind): speed up account bind detection and runtime sync
Replace the 1.8s polling interval with a 650ms tick plus a debounced navigation-driven detect, listen for page-title-updated to catch SPA transitions, and flush the session asynchronously. The bind handler now optimistically seeds the runtime account list via noteRuntimeAccountBound and fires the full server refresh in the background, so the UI reflects the new binding without waiting on a round-trip. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -18,6 +18,7 @@ import { getPlaywrightCDPPort, startHiddenPlaywrightReaper } from "./playwright-
|
||||
import { registerRendererDevtoolsProxyTarget } from "./renderer-devtools-proxy";
|
||||
import { onRuntimeInvalidated } from "./runtime-events";
|
||||
import {
|
||||
noteRuntimeAccountBound,
|
||||
refreshRuntimeAccounts,
|
||||
releaseRuntimeSession,
|
||||
syncRuntimeSession,
|
||||
@@ -289,7 +290,12 @@ function registerBridgeHandlers(): void {
|
||||
ipcMain.handle("desktop:runtime-snapshot", () => createRuntimeSnapshot());
|
||||
safeHandle("desktop:bind-publish-account", async (_event, platformId: string) => {
|
||||
const account = (await bindPublishAccount(platformId)) as DesktopAccountInfo;
|
||||
await refreshRuntimeAccounts();
|
||||
noteRuntimeAccountBound(account);
|
||||
void refreshRuntimeAccounts().catch((error) => {
|
||||
console.warn("[desktop-bind] background account refresh failed", {
|
||||
message: error instanceof Error ? error.message : String(error),
|
||||
});
|
||||
});
|
||||
return account;
|
||||
});
|
||||
safeHandle("desktop:refresh-runtime-accounts", async () => {
|
||||
|
||||
Reference in New Issue
Block a user