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:32](https://github.com/TanStack/query/blob/main/packages/query-core/src/environmentManager.ts#L32)
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`true` if the runtime is treated as a server.
38β
39### setIsServer()
40β
41```ts
42setIsServer(isServerValue: IsServerValue): void;
43```
44β
45Overrides the server check globally.
46β
47#### Parameters
48β
49##### isServerValue
50β
51`IsServerValue`
52β
53A function that returns whether the runtime should be treated as a
54server.
55β
56#### Returns
57β
58`void`
59β
60## Example
61β
62```ts
63import { environmentManager } from '@tanstack/query-core'
64β
65environmentManager.setIsServer(() => false)
66```