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:
@@ -17,7 +17,7 @@ import type { RuntimeAccount } from "../types";
|
||||
|
||||
type AccountRow = Readonly<Omit<RuntimeAccount, "tags">> & { tags: readonly string[] };
|
||||
|
||||
const { snapshot, refreshAccounts, loading } = useDesktopRuntime();
|
||||
const { snapshot, refresh, refreshAccounts, loading } = useDesktopRuntime();
|
||||
|
||||
const bindPendingPlatformId = ref<string | null>(null);
|
||||
const openPendingAccountId = ref<string | null>(null);
|
||||
@@ -156,7 +156,7 @@ async function bindPlatform(platformId: string) {
|
||||
const account = await window.desktopBridge.app.bindPublishAccount(platformId);
|
||||
const platformLabel = desktopMonitoringMediaCatalog.find((item) => item.id === platformId)?.label ?? platformId;
|
||||
showActionNotification("success", "绑定成功", `${account.display_name} 已绑定到 ${platformLabel}`);
|
||||
await refreshAccounts();
|
||||
await refresh();
|
||||
} catch (error) {
|
||||
showClientActionError("bind-account", error);
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user