-
Notifications
You must be signed in to change notification settings - Fork 786
useQuery Hook always return true on loading state - previous issue needed to be reopened #3774
Comments
this happens for me as well on 3.1.3 version of @apollo/react-hooks" |
I've had this issue appear intermittently (~1/10 loads) for a particular query, which is evidently resolved by setting |
@SethGreylyn Everyone's using that |
So I believe we're seeing this, albeit with a subscription and not a query. As a more general question: |
We are also running into this problem for queries that are have ssr false and that are hydrated from a server-response. This is currently preventing us from upgrading to anything beyond |
Can confirm I'm seeing the same issue. Looks like loading is never reset back to false once the query is loaded from the cache. |
Additional info I think might be related is it's potentially an issue with the apollo cache having issues hashing objects used to filter queries. Let's say I have filters A, B, C, D defined as:
If I start with filterB and switch to filterA or filterD, the loading state resets correctly. However, if I go from filterB to filterA, I get the issue described in this issue where the loading state never resets back to false. Hope this is helpful. |
@dustinsgoodman That seems to be correct. If you could make a small repo or codesandbox that repros this issue, it'd be a great help for the maintainers and might push them into looking into this finally. |
Yeah, I've been watching this repo for a while now and I can confirm that providing a runnable reproduction significantly increases the chances of the issue being fixed. |
Indeed but that is the case for any repo. The problem here is that this happens very seldomly and apparently under very specific circumstances. Even in prod with millions of requests, it sometimes goes 2 days without occurring to multiple times in one day. |
If you decide to report a bug, then you have taken on the responsibility of figuring out exactly what circumstances are necessary to reproduce that bug. The maintainers can't just magically know exactly what causes a bug after reading a few sentences. |
I don't necessarily agree. You should definitely try, but even if you can't pinpoint what's causing the bug, I think it's fair to let the community know/open a discussion about it. I agree with the part that it shouldn't rest solely on the maintainers shoulders. But this is clearly happening to a lot of people, so raising awareness in a respectful manner is ok too. |
@mpgon Ok fair point. I just think we shouldn't expect the maintainers to do anything until someone provides a reproduction |
For now I think we can put |
I believe that this issue might be coming from the fact that the flag My take on this would be something like this: status: {
cache:
'valid' | // The cached data for the current query is valid
'invalid' | // The cached data for the current query is invalid
'disabled', // The cache is disabled for the current query
network:
'idle' | // There is active communication for the current query
'processing' | // The current query is being processed by Apollo, and it might fetch data from remote, local or cache
'fetching' | // Data is currently being fetched from remote
'failed', // For some reason it was not possible to communicate with remote. see 'error' field.
data:
'initial' | // The data holds the initial value for the data. Might be 'undefined' or the initial value set for the local data (see @client)
'empty' | // No data is being held
'invalid' | // Current data is invalid (cache got invalidated)
'cached' | // The data is taken from cache
'remote', // THe data is taken from remote
} |
same pb on : |
This seems to be a race condition on updating the cache. No other resolution do this? |
Don't use the |
@kaatt I'm sorry I haven't had time to make a proper sandbox to prove this. As I was experimenting in sandbox, I left out apollo cache and link state which were the other common factors I'm seeing with other people's posts and was unable to repro. I think the issue lies when some state/cache manager gets involved and the loading flag not updating appropriately on a successful cache read. |
There is a closed issue that is still persisting. Multiple requests to reopen the issue have not been responded to so I'm assuming that notifications for closed issues are not being tracked and am creating a new issue to point to that closed issue.
#3361
The text was updated successfully, but these errors were encountered: