From ad816154e1c6f30e0438766683c42143926f092e Mon Sep 17 00:00:00 2001 From: Guillaume Chau Date: Mon, 19 Aug 2024 19:53:16 +0200 Subject: [PATCH] fix: reuse previous result, fix #1483 --- packages/vue-apollo-composable/src/useQuery.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/vue-apollo-composable/src/useQuery.ts b/packages/vue-apollo-composable/src/useQuery.ts index a56a3c73..92544691 100644 --- a/packages/vue-apollo-composable/src/useQuery.ts +++ b/packages/vue-apollo-composable/src/useQuery.ts @@ -341,7 +341,13 @@ export function useQueryImpl< } function processNextResult (queryResult: ApolloQueryResult) { - result.value = queryResult.data && Object.keys(queryResult.data).length === 0 ? undefined : queryResult.data + result.value = queryResult.data && Object.keys(queryResult.data).length === 0 + ? queryResult.error && + !currentOptions.value?.returnPartialData && + currentOptions.value?.errorPolicy === 'none' + ? undefined + : result.value + : queryResult.data loading.value = queryResult.loading networkStatus.value = queryResult.networkStatus // Wait for handlers to be registered