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