Apollo-client: local state doesn't work without any visible error message

Created on 5 Dec 2020  ·  1Comment  ·  Source: apollographql/apollo-client

Intended outcome:

Actual outcome:

consider following query in the official example repository:
https://github.com/apollographql/ac3-state-management-examples/blob/68dfaa0aa2100d460a76a0414d0f8b0d6767fa79/apollo-local-state/src/operations/queries/getAllTodos.tsx#L4-L11
it seems working as it is, however it's quite easy to break this functionality by adding some nested subfield, for example,

export const GET_ALL_TODOS = gql`
  query GetAllTodos {
    todos @client { 
      id  
      text
      completed
      author { # this addition breaks useQuery, it returns { data: undefined, error: undefined } WITHOUT ANY ERROR
         id    # I'd expect either to work out of the box or able to see ANY guide messages from console
         name
      }
    }
  }

How to reproduce the issue:
add above addition to the official todos example
Versions
ac 3.3.0

Most helpful comment

I'm also facing a similar issue.
I get data and error returned from useQuery both undefined (and loading is false).
And even though I've added an onError link, I don't see any output in console.log, nor does the code reach the onError function.
(In my case the error is caused because a read function of a client-only field returns undefined instead of null)

>All comments

I'm also facing a similar issue.
I get data and error returned from useQuery both undefined (and loading is false).
And even though I've added an onError link, I don't see any output in console.log, nor does the code reach the onError function.
(In my case the error is caused because a read function of a client-only field returns undefined instead of null)

Was this page helpful?
0 / 5 - 0 ratings