Open History to see the last commit
1import { isServer } from './utils'
2β
3export type IsServerValue = () => boolean
4β
5/**
6 * Manages environment detection used by TanStack Query internals.
7 */
8export const environmentManager = (() => {
9 let isServerFn: IsServerValue = () => isServer
10β
11 return {
12 /**
13 * Returns whether the current runtime should be treated as a server environment.
14 */
15 isServer(): boolean {
16 return isServerFn()
17 },
18 /**
19 * Overrides the server check globally.
20 */
21 setIsServer(isServerValue: IsServerValue): void {
22 isServerFn = isServerValue
23 },
24 }
25})()