We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e07828b commit 583da31Copy full SHA for 583da31
src/useQuery.ts
@@ -135,8 +135,17 @@ export function useQuery<
135
() => {
136
const result = observableQuery.currentResult();
137
138
+ // return the old result data when there is an error
139
+ let data = result.data as TData;
140
+ if (result.error || result.errors) {
141
+ data = {
142
+ ...result.data,
143
+ ...(observableQuery.getLastResult() || {}).data,
144
+ };
145
+ }
146
+
147
return {
- data: result.data as TData,
148
+ data,
149
error:
150
result.errors && result.errors.length > 0
151
? new ApolloError({ graphQLErrors: result.errors })
0 commit comments