You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The text was updated successfully, but these errors were encountered:
andgith
changed the title
usequery result set to undefined while refetching after updating variableusequery()result set to undefined while refetching after updating variable
Jun 15, 2023
This method gets called twice when variables change due to the query being restarted. For the first call, "data" is not present as the query is still loading so variables get cleared. For the send call, "data" will be set (for a successful request that is) and the "result" will have a value again.
Proposed solution:
functionprocessNextResult(queryResult: ApolloQueryResult<TResult>){result.value=queryResult.data&&Object.keys(queryResult.data).length===0 ? result.value : queryResult.data// Old: result.value = queryResult.data && Object.keys(queryResult.data).length === 0 ? undefined : queryResult.dataloading.value=queryResult.loadingnetworkStatus.value=queryResult.networkStatus// Wait for handlers to be registerednextTick(()=>{resultEvent.trigger(queryResult)})}
Describe the bug
The value of
result
is undefined while a refetch occurs after a variable update.Expected behavior
In versions before beta-2 did not set
result
to undefined during a refetch.Versions
vue: 3.3.4
vue-apollo: ^4.0.0-beta.1
@apollo/client: 3.7.15
The text was updated successfully, but these errors were encountered: