Skip to content

API reference > @kontsedal/olas-core > NetworkMode

NetworkMode type ​

How a query behaves with respect to the network reachability signal.

  • online (default) — pause fetches while navigator.onLine is false; automatically resume when reconnect fires (via subscribeReconnect). Inflight fetches are NOT aborted on offline; a bindEntry / acquire that lands while offline simply defers the initial fetch. The deferred entry reports isPaused: true until reconnect. A fetch requested while offline does supersede one already in flight, as a request made online does, so the older response never lands. - always — never gate on connectivity; fetcher runs whenever requested. Useful for queries against localhost / IPC / a service worker that doesn't surface through navigator.onLine. - offlineFirst — start the fetch regardless; if it rejects with a network-shaped error (a fetch TypeError; AbortError excluded) while navigator.onLine is false, park the entry (isPaused: true, status stays idle / last-success) and retry on reconnect rather than surfacing the error. Matches TanStack's offlineFirst policy for app-shell-first PWAs.

Signature:

typescript
type NetworkMode = 'online' | 'always' | 'offlineFirst';

Released under the MIT License.