My Products
Help
omelhus
PARTNER

Issue with fragments (An item with the same key has already been added.)

by omelhus

Hey,

 

The following query fails and returns an error message.

 

fragment Product on Product {
  productNo
}

fragment Prod2 on Product {
  __prodNo: productNo
}

query IssueWithFragment($cid: Int!) {
  useCompany(no: $cid){
    product {
      items {
        ...Prod2
        ...Product
      }
    }
  }
}

 

 

The error response

 

 

{
  "errors": [
    {
      "message": "An item with the same key has already been added. Key: productNo",
      "path": [
        "useCompany",
        "product"
      ]
    }
  ],
  "data": {
    "useCompany": {
      "product": null
    }
  },
  "extensions": {
    "vbnxt-trace-id": "0000000000000000957e21d6f252d971"
  }
}

 

 

I'm guessing that a an Add should be changed to TryAdd.

3 REPLIES 3
Accepted solution
Marius Bancila
VISMA

by Marius Bancila

The fix for this error has been deployed to production.

omelhus
PARTNER

by omelhus

Thank you!

by Marius Bancila

Thanks for reporting this. It's something along the line of what you mentioned. I'll look into fixing this!