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

multidimensional arrays result in Can't find field value on result object #776

Closed
dylang opened this issue Oct 15, 2016 · 2 comments
Closed
Assignees
Labels
Milestone

Comments

@dylang
Copy link

dylang commented Oct 15, 2016

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!

@stubailo
Copy link
Contributor

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.

@stubailo stubailo added this to the Release 0.5 milestone Oct 15, 2016
stubailo pushed a commit that referenced this issue Oct 15, 2016
@stubailo stubailo self-assigned this Oct 15, 2016
stubailo pushed a commit that referenced this issue Oct 15, 2016
@dylang
Copy link
Author

dylang commented Oct 19, 2016

I can verify that the nested array issue I reported is now working for me using apollo-client@0.5.0-1. Thank you for the super quick turnaround!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants