Skip to main content

Function: useBackendFocusSync()

useBackendFocusSync(enabled: boolean): void

Defined in: src/hooks/useBackendFocusSync.ts:44

Custom hook that synchronizes application data when the window gains focus.

Parametersโ€‹

enabledโ€‹

boolean = false

Set to true to enable focus-based backend synchronization (defaults to false).

Returnsโ€‹

void

void โ€“ the hook only manages side effects.

Exampleโ€‹

function App() {
const [syncOnFocus, setSyncOnFocus] = useState(true);

// Enable automatic sync when user returns to app
useBackendFocusSync(syncOnFocus);

return <div>App content</div>;
}

Seeโ€‹

useSitesStore for the backing store implementation.