Skip to content
0

katanakit-js / environmentManager

Variable: environmentManager ​

ts
const environmentManager: {
  isServer: () => boolean;
  setIsServer: void;
};

Defined in: node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/environmentManager.d.ts:24

Manages how TanStack Query detects whether the current runtime should be treated as server-side, which disables scheduling refetch timers and changes the default retry count and gcTime. By default, the detection treats a missing window (or the presence of a Deno global) as server.

Override this for runtimes where that default detection would give the wrong answer — for example, a Service Worker, where window is undefined even though the environment should behave like a client.

Type Declaration ​

isServer ​

ts
isServer: () => boolean;

Returns ​

boolean

setIsServer() ​

ts
setIsServer(isServerValue): void;

Overrides the server check globally.

Parameters ​

ParameterType
isServerValueIsServerValue

Returns ​

void

Example ​

ts
import { environmentManager } from '@tanstack/query-core'

environmentManager.setIsServer(() => false)

Released under the MIT License.