fix(ui): poll vault state so background Amber pairing appears without reload

This commit is contained in:
Avi 2026-09-23 14:30:07 -05:00
commit a8d112b368

View file

@ -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<ProfileSummary> => {
const result = await api.createProfile(label, state?.settings);