Skip to content

useAutoReconnect

useAutoReconnect(): AutoReconnectState

Defined in: console-sdk/src/react/hooks/useAutoReconnect.ts:188

The global auto-reconnect switch, the reconnected-device feed derived from connection provenance, and the settling flag (SDK_PLAN.md §3.6.3). setEnabled sets and persists the switch; acknowledge(id?) dismisses one device (omit id for all) so recentlyReconnected drops it without a stored event; isSettling is true while any reconnect/connect attempt is in flight. Reactive and referentially stable. Throws OutsideProviderError when no <ConsoleProvider> is above the caller.

AutoReconnectState

const { recentlyReconnected, acknowledge } = useAutoReconnect();
if (recentlyReconnected.length === 0) return null;
return <Toast onDismiss={() => acknowledge()} />;