data set to {} between re-fetches
See original GitHub issueI created this small example to show my issue:
https://codesandbox.io/s/ovw0m6yl4z
Basically, every time I re-render the component and useQuery
fetches new data, the data
object is set to {}
while loading
is true
.
How can I preserve the previously fetched data while I load new data?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:10
- Comments:10 (2 by maintainers)
Top Results From Across the Web
Refetching queries in Apollo Client - Apollo GraphQL Docs
refetch () . When onQueryUpdated is provided, it can dynamically decide whether (and how) each query should be refetched. Returning false from onQueryUpdated ......
Read more >Refetching Fragments with Different Data - Relay
Relay guide to refetching fragments with different data. ... The first argument is the set of variables to fetch the fragment with.
Read more >Refetching and Loading More Data - RescriptRelay
Sometimes you'll want to refresh or refetch data in specific parts of your views without re-issuing the full query the data was originally...
Read more >[^3.0.0] data is undefined while loading #7038 - GitHub
If firing a larger number of refetches, this actually is set to 2 ... previousData separately from result.data , as I proposed in...
Read more >React Query Refetching Stale Data - React Tutorial 88
FREE Courses (100+ hours) - https://calcur.tech/all-in-ones Python Course - https://calcur.tech/python-courses✓ Data Structures ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Any news on this ?
@FezVrasta I’m not a fan of this behavior (it’s a breaking change for me in some cases), but I’m going to fix it to make it similar to react-apollo. I prepared #134 - it uses
setValues
similar to how it’s done there. It should also fix #129. Unfortunately, it requires further work (currently it breaks the suspense mode).