Skip to content
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

Response without data when fetchPolicy: 'no-cache' isn't present #3272

Closed
3 tasks
andfs opened this issue Apr 5, 2018 · 5 comments
Closed
3 tasks

Response without data when fetchPolicy: 'no-cache' isn't present #3272

andfs opened this issue Apr 5, 2018 · 5 comments

Comments

@andfs
Copy link

andfs commented Apr 5, 2018

Version

  • [email protected]

  • [x ] has-reproduction

  • feature

  • docs

  • [x ] blocking

  • good first issue
    -->

I'm using [email protected] with angular 4, and all responses of a query return with data = undefined when fetching without fetchPolicy: 'no-cache'. This error occurs in react too.

Response without fetchPolicy:
without_cache

Response with fetchPolicy: 'no-cache':
no_cache

@michaelknoch
Copy link
Contributor

experiencing the same issue on [email protected]

@n1ru4l
Copy link
Contributor

n1ru4l commented Apr 23, 2018

@michaelknoch @andfs Could you please clarify what exactly causes this issue? I am trying to figure out if my issue is also related to this issue..

My Query components that use the no-cache policy do not update after the data was fetched from the server.

Changing the policy back to network-only resolves this issue. However it has the side-effect of the data being stored in the cache..

    "apollo-cache-inmemory": "1.1.12",
    "apollo-cache-persist": "0.1.1",
    "apollo-client": "2.2.8",
    "apollo-link": "1.2.2",
    "apollo-link-context": "1.0.8",
    "apollo-link-http": "1.5.4",
    "apollo-link-retry": "2.2.3",
    "apollo-utilities": "1.0.11",
    "react-apollo": "2.1.3",

@ghost
Copy link

ghost commented Apr 23, 2018

What I'm doing to get around this bug is first asking with fetchPolicy: cache-first, then after I've got the data I ask for a fetchPolicy: network-only. Without this method I'd get only either cached data (F5 to update), or network-only.

It isn't strictly related to 'no-cache', but I'm here to confirm that something's wrong with the cache handling.

@hwillson
Copy link
Member

hwillson commented Aug 2, 2018

Would someone here be able to provide a small runnable reproduction that shows this happening? Ideally with just Apollo Client (or React Apollo). Angular related issues should be opened in the https://github.com/apollographql/apollo-angular repo. Thanks!

@hwillson
Copy link
Member

hwillson commented Aug 3, 2018

Just to follow up here - the original issue does not sound like an Apollo Client issue. If this problem is still happening, please re-open this issue in the Apollo Angular repo.

That being said, #3272 (comment) is an Apollo Client issue. If you're passing a fetchPolicy of no-cache into your Query components, there's a good chance you were running into the issue #3777 now fixes. Since #3777 has been merged (and will be released shortly), I'll close this off. Thanks!

@hwillson hwillson closed this as completed Aug 3, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants