fix: dialog

This commit is contained in:
Gab
2026-04-09 23:08:01 +10:00
parent f72686a74a
commit f7a8776265

View File

@@ -143,9 +143,17 @@ export function DialogTfMcp() {
duration: 3000,
})
}
const status = await sdk.client.mcp.status()
if (status.data) {
sync.set("mcp", reconcile(status.data))
// Poll until status reflects the change (MCP SSE handshake is async)
const wantConnected = !isEnabled()
for (let i = 0; i < 10; i++) {
await new Promise((r) => setTimeout(r, 500))
const status = await sdk.client.mcp.status()
if (status.data) {
sync.set("mcp", reconcile(status.data))
const current = status.data[TF_MCP_NAME]?.status === "connected"
if (current === wantConnected) break
}
}
} catch (error) {
toast.show({