Apollo-client: multidimensional arrays result in Can't find field value on result object

Created on 15 Oct 2016  路  2Comments  路  Source: apollographql/apollo-client

This works fine in GraphiQL, but when I use it in Apollo Client I get

Can't find field value on result object $ROOT_QUERY.multidimensional().rows.0."
networkError

Hypothetical Schema

type Table {
    rows: [ [ Cell ] ] # This is causing issues
}
type Cell {
    value: Float
}

Hypothetical JQL

{
  multidimensional() {
    table {
      rows {
        value
      }
    }
  }
}

Hypothetical result

[
  [{ value: 1 }],
  [{ value: 2 }],
  [{ value: 3 }]
]

This works as expected when testing with GraphiQL.

In Apollo client this throws an error.

The issue is made apparent in const value: any = result[resultFieldKey]; because resultFieldKey is value, but result is an _array_ of Cell types, rather than a single Cell type.

I feel like I tried many alternative query and schema layouts to work around this issue, but none have helped. I've only have a few hours of experience using GraphQL and Apollo, so I will be excited to learn if I'm doing something incorrectly or this is an issue that can be fixed in the client.

Thank you!

馃悶 bug

All 2 comments

I think this is an accidental oversight that will be fixed in Apollo Client 0.5, since we've now refactored to use graphql-anywhere: https://github.com/apollostack/graphql-anywhere

We're hoping to publish a 0.5 preview in the next day or two, I'll make sure to post here.

I can verify that the nested array issue I reported is now working for me using [email protected]. Thank you for the super quick turnaround!

Was this page helpful?
0 / 5 - 0 ratings