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:29](https://github.com/TanStack/query/blob/main/packages/query-core/src/environmentManager.ts#L29)
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### setIsServer()
36β
37```ts
38setIsServer(isServerValue: IsServerValue): void;
39```
40β
41Overrides the server check globally.
42β
43#### Parameters
44β
45##### isServerValue
46β
47`IsServerValue`
48β
49#### Returns
50β
51`void`
52β
53## Example
54β
55```ts
56import { environmentManager } from '@tanstack/query-core'
57β
58environmentManager.setIsServer(() => false)
59```