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
Intended outcome:
In the following reproduction, I'm managing pagination with fetch more and field policies. When the user wants to refetch the data, the refetch query will execute with the initial query variables which is pageNumber: 0 and I'm totally fine with that. What I want to achieve is, I would like to delete the cached fields by using cache.modify (or with writeQuery and custom handling in merge function) and refetch the first 10 again so that I can get the fresh data when I execute fetchMore. I would like to see cache deletes the data and when refetch is executed I would like to see the fresh data hit my custom merge function.
Actual outcome:
In this case, cache deletes the data, refetch hits the graphql resolver but not hit the field policy. I thought that this is because I delete the root query field not the cached data itself. So I even do cache.gc() to delete everything, but; but still couldn't get it.
1-> Click Change Status Type: 1
2-> Click Load More
3-> Click refetch
4-> You will see empty data
** The interesting flow that I think because of the variable change cache gets the data:
1-> Click Change Status Type: 1
2-> Click refetch
3-> Nothing happens in UI
4-> Click Load More
5-> The second page will be received
Thanks for all your hardwork, it's an awesome library with lots of benefits.
The text was updated successfully, but these errors were encountered:
ErkinKurt
changed the title
After removing cached field refetch doesn't hit the cache policy and behaves unpredictable
After removing cached field refetch doesn't hit the cache policy and behaves unpredictabley
Aug 25, 2020
ErkinKurt
changed the title
After removing cached field refetch doesn't hit the cache policy and behaves unpredictabley
After removing cached field refetch doesn't hit the cache policy and behaves unpredictably
Aug 25, 2020
@ErkinKurt Thanks to your reproduction, I am reasonably confident that updating to @apollo/[email protected] will solve the problem, with no changes to your code. See #6898, #6817, and #6448 for more details if you're interested.
Intended outcome:
In the following reproduction, I'm managing pagination with fetch more and field policies. When the user wants to refetch the data, the refetch query will execute with the initial query variables which is
pageNumber: 0
and I'm totally fine with that. What I want to achieve is, I would like to delete the cached fields by usingcache.modify
(or withwriteQuery
and custom handling in merge function) and refetch the first 10 again so that I can get the fresh data when I execute fetchMore. I would like to see cache deletes the data and when refetch is executed I would like to see the fresh data hit my custom merge function.Actual outcome:
In this case, cache deletes the data, refetch hits the graphql resolver but not hit the field policy. I thought that this is because I delete the root query field not the cached data itself. So I even do
cache.gc()
to delete everything, but; but still couldn't get it.How to reproduce the issue:
Here is a reproduction link: https://github.com/ErkinKurt/react-apollo-error-template/tree/delete-cache-and-refetch
1-> Click Change Status Type: 1
2-> Click Load More
3-> Click refetch
4-> You will see empty data
** The interesting flow that I think because of the variable change cache gets the data:
1-> Click Change Status Type: 1
2-> Click refetch
3-> Nothing happens in UI
4-> Click Load More
5-> The second page will be received
Thanks for all your hardwork, it's an awesome library with lots of benefits.
Versions
The text was updated successfully, but these errors were encountered: