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

Fragmenting on a Union type will throw when storing the result to state #354

Closed
joarwilk opened this issue Jul 5, 2016 · 0 comments
Closed
Labels

Comments

@joarwilk
Copy link

joarwilk commented Jul 5, 2016

Given this GraphQL Schema:

type RootQueryType {
  fruitList: [Fruits]
}

union Fruits = Apple | Orange

type Apple {
  color: String
}

type Orange {
  weight: Int
}

And this query:

fruitList {
  ... on Apple {
    color
  }
  ... on Orange {
    weight
  }
}

And this server response:

{
  fruitlist: [
    {
      __typename: 'Apple',
      color: 'Red'
    }
  ]
}

The client will throw at this line, claiming it's missing the "weight" property. In this case the client should ignore the "weight" property since the returned object is of type Apple.

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

3 participants