Skip to main content
Version: 57.2.0

useServerStatus

useServerStatus(options?): OfflineStatus

Polls the API server health endpoint to determine actual server reachability. Dispatches setOnlineStatus(true/false) into the offline slice so the rest of the offline middleware (queue, optimistic updates, replay) reacts.

Use this instead of useOfflineStatus when you want real server-connectivity detection rather than just browser navigator.onLine.

Parameters

options?

ServerStatusOptions = {}

Returns

OfflineStatus

Example

const {isOnline, queueLength, isSyncing, isLocalOnly} = useServerStatus({
skip: !userId,
});