So running this query in graphiql returns
{
"data": {
"orders": [
{
"id": "1",
...
"foods": [
{
"id": "1",
"name": "test",
"OrdersFoods": {
"id": "1",
"qty": 1,
"delivered": false
}
},
{
"id": "2",
"name": "otro plato",
"OrdersFoods": {
"id": "2",
"qty": 1,
"delivered": false
}
}
]
},
{
"id": "2",
...
"foods": [
{
"id": "1",
"name": "test",
"OrdersFoods": {
"id": "3",
"qty": 2,
"delivered": false
}
},
{
"id": "2",
"name": "otro plato",
"OrdersFoods": {
"id": "4",
"qty": 2,
"delivered": false
}
}
]
}
]
}
}
but running it inside a component
class OrdersContainer extends Component {
componentDidMount() {
}
render() {
const {
data: { loading, orders = [] },
onlyPendents,
component: Component,
...props
} = this.props
console.log(orders)
return !loading && orders.length ? (
<Component
data={[...orders].sort((a, b) => !!a.delivered)}
delivered={variables.delivered}
showDeliverButton={!variables.delivered}
{...props}
/>
) : (
<h3>No hay órdenes que mostrar</h3>
)
}
}
export default graphql(ordersQuery)(OrdersContainer)
console.log returns

as you can see, OrdersFoods is returning with the same objects (id:1, id:2) , which is not what I would expect as It received the right data which I verified in the network tab on chrome devtools.
Also, my schema is
type Order {
id: ID!
table: Int!
amount: Int!
createdBy: String!
createdAt: String!
comments: String
foods: [FoodOrder!]
paid: Boolean!
delivered: Boolean
}
type OrdersFoods {
id: ID!
qty: Int!
delivered: Boolean
foodId: String!
orderId: String!
}
type FoodOrder {
id: ID!
name: String!
OrdersFoods: OrdersFoods!
}
type Query {
orders: [Order]
}
I am using [email protected], [email protected]

Thanks
This issue has been automatically labled because it has not had recent activity. If you have not received a response from anyone, please mention the repository maintainer (most likely @jbaxleyiii). It will be closed if no further activity occurs. Thank you for your contributions to React Apollo!
This issue has been automatically closed because it has not had recent activity after being marked as no recent activyt. If you belive this issue is still a problem or should be reopened, please reopen it! Thank you for your contributions to React Apollo!
I just stumbled across the same issue myself. I believe it is because your ids are not unique for the type (eg you reuse order ids 1 and 2).
To fix it properly, use unique identifiers. A workaround is to not request the id field, or put that value in a different field so Apollo doesn’t try to normalize it
This happened to me too, because I had implemented my inMemoryCache with a custom dataIdFromObject function, that would just return obj.id. I think the id's need to be unique across all types? I removed this and the default inMemoryCache (which is sufficient for me) worked fine.
I had the same issue and can confirm what @DogsForArms noted. I removed my custom dataIdFromObject function, which would return obj.id, within my inMemoryCache and it solved my problem. We were using UUIDs before and recently changed our database to use integers - this is when the issue with receiving incorrect data started.
Just had this same issue. I had a type that had an id property on it that was not needed or used leading the id of anything with that type to be null, and all of the data would get mixed up like this as well. Everywhere that type was, it would be the same object. After removing that unused field, it fixed the issue. One thing that was interesting that I'll add, was if I made the query a mutation, this issue went away also. But glad I figured out the real issue. Thanks to all of you for sharing.
Most helpful comment
This happened to me too, because I had implemented my inMemoryCache with a custom dataIdFromObject function, that would just return obj.id. I think the id's need to be unique across all types? I removed this and the default inMemoryCache (which is sufficient for me) worked fine.