Response array with null values is discarded #1277

Open
koenpunt opened this Issue Feb 9, 2017 · 3 comments

Projects

None yet

3 participants

@koenpunt
koenpunt commented Feb 9, 2017

We're using Apollo client with React, and for a certain query the graphql response contains null values in an array.

Part of our schema:

union BodyElement = HtmlElement

type HtmlElement {
  name: String
  value: String
}

type Article implements Node {
  body: [BodyElement]
}

Graphql response::

"body": [
  {
    "__typename": "HtmlElement",
    "name": "p",
    "value": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
  },
  null,
  {
    "__typename": "HtmlElement",
    "name": "p",
    "value": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
  },
  {
    "__typename": "HtmlElement",
    "name": "h2",
    "value": "Lorem Ipsum"
  },
  null,
  {
    "__typename": "HtmlElement",
    "name": "p",
    "value": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
  },
  {
    "__typename": "HtmlElement",
    "name": "p",
    "value": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
  }
]

Where I expect the values being passed on as-is, so just null values, the response is discarded completely, without error.

Is this expected behaviour?

@calebmer
Collaborator
calebmer commented Feb 9, 2017

Is the entire response being discarded, or just those null items?

@calebmer calebmer added the bug label Feb 9, 2017
@koenpunt
koenpunt commented Feb 9, 2017

I can see the response in the Redux devtools, but it is not passed to the graphql container.

@helfer
Member
helfer commented Feb 11, 2017

@koenpunt Could you make a PR with a failing test? I think that should be relatively straightforward and it would help us fix this quickly 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment