From 4679a042794070294641b8f35a25b33b29e5044d Mon Sep 17 00:00:00 2001 From: Guillaume Chau Date: Mon, 19 Aug 2024 20:04:58 +0200 Subject: [PATCH] fix: reuse previous result, fix #1483 (#1569) --- 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