question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@apollo/client v3.0.0-beta.1 `partialRefetch: true` not working

See original GitHub issue

Intended outcome:

I’m attempting to use partialRefetch to refetch a partial array item that was add as a result of an “add” mutation.

Actual outcome:

Instead of an empty data object, the returned array is simply missing the partial objects.

How to reproduce the issue:

Client: https://codesandbox.io/s/apollo-empty-data-bug-client-ycntj Server: https://codesandbox.io/s/apollo-empty-data-bug-server-8ncuk

Line 43 can be uncommented to see the behavior when there is no partial data (i.e., the title is returned by the mutation). When that line is commented, the missing title causes the workspaces’ todos to come back as partial data and even though partialRefetch is specified, there is no refetch.

Versions

@apollo/client: 3.0.0-beta.1

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
miguelollercommented, Jan 15, 2020

@benjamn and @hwillson, it seems to be working now!

I do have a question, though. When refetching, data is set to undefined while loading is true. Would it make sense to keep data as the last fetched value while the refetch is happening?

More specifically, I expected the behavior to be that of refetch where loading doesn’t change and networkStatus goes to 4 for “refetching”. While the data is being fetched, the old data is untouched.

1reaction
hwillsoncommented, Jan 14, 2020

Ahh, I misinterpreted your explanation @migueloller, sorry about that! Re-opening.

Read more comments on GitHub >

github_iconTop Results From Across the Web

apollo/client v3.0.0 partialRefetch: true unexpected network ...
That issue was closed stating the problem had been fixed, but that is not the case. The network status now goes from 1...
Read more >
Queries - Apollo GraphQL Docs
When your component renders, useQuery returns an object from Apollo Client that contains loading , error , and data properties you can use...
Read more >
'loading' remains true when loading data with 'useQuery' using ...
I don't know what the problem is. Any help would be appreciated. react-native · apollo-client · Share.
Read more >
vue/apollo-composable - Awesome JS
Fixed subscription error handling to work around some Apollo Client ... fix(smart query): initial data not retrieved from cache if query was fetched...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found