-
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
fetchPolicy: 'network-only' not working on client.query({...}) when 'ssrMode': true set on ApolloClient. #2983
Comments
Facing weird problems. It seems that client is still reading from cach, after that the network is storing the data in the cache. What means that you always one step behind. |
In apollo-client 2.2.2, a fetchPolicy of 'no-cache' was added which may fix this issue. |
const getDetails = graphql(DetailsViewQuery, { Still gives cached results in React Native |
The original issue here
actually functions as designed: apollo-client/packages/apollo-client/src/ApolloClient.ts Lines 239 to 241 in ca5a211
Setting |
@hwillson with ssrMode: true and Query component in react-apollo, fetchPolicy 'network-only' returns cached value https://github.com/apollographql/react-apollo/issues/556 which means if ssrMode is true, all queries return cached data, even set ssr={false} on Query component |
Thanks @sea129 - apollographql/react-apollo#556 is still open, so we'll get to it shortly. |
@kapilpipaliya I had issues with client.query also. I solved it by chanaging:
to
If dig into the code, you can see the all params passed into |
thank you @duwerq |
Thank you so much @duwerq ! |
thank you. you saved me at dawn. @duwerq |
Where is the use of client.query documented? It seems like we're all just debating the spec of the function here Also thank you @duwerq you saved me many hours of trial and error |
I used this config now the data is not cached. In my react native application.
|
For me, in graphql() HOC, when i changed the options to functions it worked. Its weird, but worked. graphql(SAMPLE_DATA_GQL, { |
fetchPolicy: 'network-only' not working on client.query({...})
The text was updated successfully, but these errors were encountered: