File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change 5
5
FetchMoreOptions ,
6
6
FetchMoreQueryOptions ,
7
7
FetchPolicy ,
8
+ NetworkStatus ,
8
9
ObservableQuery ,
9
10
OperationVariables ,
10
11
QueryOptions ,
@@ -27,6 +28,8 @@ export interface QueryHookState<TData>
27
28
'error' | 'errors' | 'loading' | 'partial'
28
29
> {
29
30
data ?: TData ;
31
+ // networkStatus is undefined for skipped queries or the ones using suspense
32
+ networkStatus : NetworkStatus | undefined ;
30
33
}
31
34
32
35
export interface QueryHookOptions < TVariables >
@@ -134,6 +137,10 @@ export function useQuery<TData = any, TVariables = OperationVariables>(
134
137
: result . error ,
135
138
errors : result . errors ,
136
139
loading : result . loading ,
140
+ // don't try to return `networkStatus` when suspense it's used
141
+ // because it's unreliable in that case
142
+ // https://github.com/trojanowski/react-apollo-hooks/pull/68
143
+ networkStatus : suspend ? undefined : result . networkStatus ,
137
144
partial : result . partial ,
138
145
} ;
139
146
} ,
@@ -186,6 +193,7 @@ export function useQuery<TData = any, TVariables = OperationVariables>(
186
193
data : undefined ,
187
194
error : undefined ,
188
195
loading : false ,
196
+ networkStatus : undefined ,
189
197
} ;
190
198
}
191
199
You can’t perform that action at this time.
0 commit comments