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 55 FetchMoreOptions ,
66 FetchMoreQueryOptions ,
77 FetchPolicy ,
8+ NetworkStatus ,
89 ObservableQuery ,
910 OperationVariables ,
1011 QueryOptions ,
@@ -27,6 +28,8 @@ export interface QueryHookState<TData>
2728 'error' | 'errors' | 'loading' | 'partial'
2829 > {
2930 data ?: TData ;
31+ // networkStatus is undefined for skipped queries or the ones using suspense
32+ networkStatus : NetworkStatus | undefined ;
3033}
3134
3235export interface QueryHookOptions < TVariables >
@@ -134,6 +137,10 @@ export function useQuery<TData = any, TVariables = OperationVariables>(
134137 : result . error ,
135138 errors : result . errors ,
136139 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 ,
137144 partial : result . partial ,
138145 } ;
139146 } ,
@@ -186,6 +193,7 @@ export function useQuery<TData = any, TVariables = OperationVariables>(
186193 data : undefined ,
187194 error : undefined ,
188195 loading : false ,
196+ networkStatus : undefined ,
189197 } ;
190198 }
191199
You can’t perform that action at this time.
0 commit comments