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

CacheMissException if __typename not in query #785

Closed
ninodinatale opened this issue Dec 18, 2020 · 6 comments
Closed

CacheMissException if __typename not in query #785

ninodinatale opened this issue Dec 18, 2020 · 6 comments
Labels
needs more info More information is required v4 Issue with a v4 library

Comments

@ninodinatale
Copy link

ninodinatale commented Dec 18, 2020

Describe the issue
Throws CacheMissException if __typename is not provided in the query:

Round trip cache re-read failed: cache.readQuery(request) returned null

To Reproduce
Steps to reproduce the behavior:

query changes($id: ID!) {
    task(id: $id) {
        changes {
            id
            name
        }
    }
}

working query:

query changes($id: ID!) {
    task(id: $id) {
        __typename
        changes {
            __typename
            id
            name
        }
    }
}

Expected behavior
Either no need to add __typename to the query or a more concise error message.

device / execution context
localhost, iOS and android simulator

@micimize
Copy link
Collaborator

@ninodinatale will need a few more details here – 

  • are you using the gql helper?
  • do you know if the result.data from the server was null? Can you set a breakpoint in _resolveQueryOnNetwork to find out?

@ninodinatale
Copy link
Author

@micimize sure:

  • I am using Artemis for generating typed queries which uses gql internally, so yes, I guess?
  • The result.data was not null.

@micimize
Copy link
Collaborator

I was referring to the gql helper provided by our libraries – Artemis doesn't add __typename automatically. Of course this is still an issue – the cache round-trip should work regardless as long as both write and read use the same AST. Will try and take a look soon

@micimize
Copy link
Collaborator

@ninodinatale I still need a sample of the data causing the failure to be able to tell what's going wrong. What code path and preconditions are present would also help – i.e. client.query, using the Query widget, and what FetchPolicy you're using

@micimize
Copy link
Collaborator

@ninodinatale after #795, this is one of the only issues I consider blocking the release of a stable v4, but I really need more info to figure out what the problem is.

@micimize micimize added the needs more info More information is required label Jan 31, 2021
@micimize micimize mentioned this issue Jan 31, 2021
@micimize
Copy link
Collaborator

closing due to lack of response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs more info More information is required v4 Issue with a v4 library
Projects
None yet
Development

No branches or pull requests

2 participants