File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed
Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -2,8 +2,10 @@ import React from 'react'
22
33import { QueryClient } from '../core'
44
5- interface GlobalOrWindow {
6- ReactQueryClientContext ?: React . Context < QueryClient | undefined >
5+ declare global {
6+ interface Window {
7+ ReactQueryClientContext ?: React . Context < QueryClient | undefined >
8+ }
79}
810
911const defaultContext = React . createContext < QueryClient | undefined > ( undefined )
@@ -16,15 +18,12 @@ const defaultContext = React.createContext<QueryClient | undefined>(undefined)
1618// of module scoping.
1719function getQueryClientContext ( ) {
1820 // @ts -ignore (for global)
19- if ( typeof global !== 'undefined' || typeof window !== 'undefined' ) {
20- // @ts -ignore (for global)
21- const thisContext = ( global || window ) as GlobalOrWindow
22-
23- if ( ! thisContext . ReactQueryClientContext ) {
24- thisContext . ReactQueryClientContext = defaultContext
21+ if ( typeof window !== 'undefined' ) {
22+ if ( ! window . ReactQueryClientContext ) {
23+ window . ReactQueryClientContext = defaultContext
2524 }
2625
27- return thisContext . ReactQueryClientContext
26+ return window . ReactQueryClientContext
2827 }
2928
3029 return defaultContext
You can’t perform that action at this time.
0 commit comments