mattkrick / cashay

:moneybag: Relay for the rest of us :moneybag:
MIT License
453 stars 28 forks source link

Nested @live triggers empty query #158

Closed dustinfarris closed 7 years ago

dustinfarris commented 7 years ago

If a regular query has a nested @live field, an empty query is triggered.

e.g., if i have

query {
  project(id: $project_id) {
    id
    name
    projectTodos @live {
      id
      description
    }
  }
}

cashay fires the subscriber for projectTodos everything is great, then when redux triggers a new stateToComputed which triggers another cashay.query(projectQuery, ... this gets sent to the server:

query ($project_id: ID!) {
  project(id: $project_id)
}

which throws an error because no subfields are selected.

I'm not sure why cashay is sending this to the server in the first place.

Note that if the project field is also marked @live or @cached this doesn't happen. Only if its a vanilla field.

mattkrick commented 7 years ago

sorry for the late response. this is actually a really annoying part of GraphQL...

https://github.com/graphql/graphql-js/issues/410