From a8d112b368680c5254aa53749b9ee3c683e50f7d Mon Sep 17 00:00:00 2001 From: Avi Date: Wed, 23 Sep 2026 14:30:07 -0500 Subject: [PATCH] fix(ui): poll vault state so background Amber pairing appears without reload --- frontend/src/state/AppProvider.tsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/frontend/src/state/AppProvider.tsx b/frontend/src/state/AppProvider.tsx index 0755b0a..000d8e0 100644 --- a/frontend/src/state/AppProvider.tsx +++ b/frontend/src/state/AppProvider.tsx @@ -141,6 +141,18 @@ export function AppProvider({ children }: { children: ReactNode }) { }; }, []); + // Background pairing completes server-side with no push channel to the UI + // (IPC is request/response), so poll for fresh state: otherwise Home and + // Profiles keep showing the pre-pairing snapshot after Amber connects. + // getState is a cheap local vault read; errors are ignored here since every + // screen surfaces its own request failures. + useEffect(() => { + const timer = window.setInterval(() => { + void refresh().catch(() => {}); + }, 5000); + return () => window.clearInterval(timer); + }, [refresh]); + const createProfile = useCallback( async (label: string): Promise => { const result = await api.createProfile(label, state?.settings);