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