Open History to see the last commit
1---
2id: environmentManager
3title: environmentManager
4redirect_from:
5 - reference/environmentManager
6---
7β
8```ts
9const environmentManager: object;
10```
11β
12Defined in: [packages/query-core/src/environmentManager.ts:29](https://github.com/TanStack/query/blob/main/packages/query-core/src/environmentManager.ts#L29)
13β
14Manages how TanStack Query detects whether the current runtime should be treated as
15server-side, which disables scheduling refetch timers and changes the default `retry` count
16and `gcTime`. By default, the detection treats a missing `window` (or the presence of a
17`Deno` global) as server.
18β
19Override this for runtimes where that default detection would give the wrong answer β for
20example, a Service Worker, where `window` is undefined even though the environment should
21behave like a client.
22β
23## Type Declaration
24β
25### isServer()
26β
27```ts
28isServer: () => boolean;
29```
30β
31Returns whether the current runtime should be treated as a server environment.
32β
33#### Returns
34β
35`boolean`
36β
37### setIsServer()
38β
39```ts
40setIsServer(isServerValue: IsServerValue): void;
41```
42β
43Overrides the server check globally.
44β
45#### Parameters
46β
47##### isServerValue
48β
49`IsServerValue`
50β
51#### Returns
52β
53`void`
54β
55## Example
56β
57```ts
58import { environmentManager } from '@tanstack/query-core'
59β
60environmentManager.setIsServer(() => false)
61```