-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
useLazyQuery doesn't work with cache-and-network fetch policy #7171
Comments
Happening here too |
The
But as mentioned on the docs, after triggered it should behave like a
|
i can confirm that setting |
Happening here too. Any work around? |
Same issue here. |
Not working also with |
Same issue, using |
this is work for me
|
it seems that the
|
I have similar issue.
didn't work for me. When I switch to regular query, it works just fine with cache. Thanks |
Hi team, But I'm facing this issue too. I tried 3.5.0 version and the latest 3.10.0. Nothing helped me. Will try to change useLazyQuery to a common useQuery, or try to remove cached response. |
I have the same problem with the latest version of Apollo Client! |
For me, I noticed that using cache-and-network the server is not requested. For some reasons, adding a random @Local field for the type retuned by the server forces the request to the server. but I think that this is a workaround that shouldn't be trusted. So, anyone have a similar issue or has solved the issue? Thanks |
@NiccoloCase could you please create a reproduction where this is not happening so we can investigate it? |
@phryneas Hi, thanks for the reply! I spent the past couple of days trying to replicate the issue in a fresh React (web, for simplicity) project using the same API, but I wasn’t able to reproduce it. I don’t think if the fact that it's a React Native project and not a web project can influence test test, but I think it might be due to a unique combination of cache policies along with the cache persistor. As a temporary workaround, I’ve set the nextFetchPolicy to cache-and-network for the lazyQuery, but I’ll continue investigating. |
Intended outcome:
After the lazy query be triggered, it should behave correctly according to the fetch policy chosen
Actual outcome:
The fetch policy
cache-and-network
isn't working when using lazy queries. It should look on the server and update the cache with the most recent data.How to reproduce the issue:
Execute
useLazyQuery
hook using fetch-policy ascache-and-network
on@apollo/client
v3.1.3.Also, I'm setting
cache-and-network
as the default fetch policy for all queries. Refer to the config:Versions
The text was updated successfully, but these errors were encountered: