fix(ui): poll vault state so background Amber pairing appears without reload
This commit is contained in:
parent
fb149763d5
commit
a8d112b368
1 changed files with 12 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue