apollographql / react-apollo

:recycle: React integration for Apollo Client
https://www.apollographql.com/docs/react/
MIT License
6.85k stars 790 forks source link

Impossible to access the cache in ApolloMockedProvider with `{}` in query parameters #4005

Closed MakhBeth closed 4 years ago

MakhBeth commented 4 years ago

I have this Query:

 query KycIbanFile($vat: String!) {
    ibanFile: documents(where: {
        document_type: { _eq: IBAN }
        company: { vat_code: { _eq: $vat } }
      }
      limit: 1
      order_by: { update_timestamp: desc_nulls_last }
    ) {
      id
    }
  }

The query is mocked and everything works fine. In a component I try to access the cache with that query and that's the output:

Can't find field documents
({"limit":1,"order_by":{"update_timestamp":"desc_nulls_last"},
"where":{"company":{"vat_code":{"_eq":"000000000000"}},
"document_type":{"_eq":"IBAN"}}})
on object "documents
({\"limit\":1,\"order_by\":{\"update_timestamp\":\"desc_nulls_last\"},
\"where\":{\"company\":{\"vat_code\":{\"_eq\":\"00000000000\"}},
\"document_type\":{\"_eq\":\"IBAN\"}}})": [],

EDIT, sorry I rubberducked. :D