Relay: Array Warning: The record contains two instances of the same id

Created on 10 Aug 2020  路  8Comments  路  Source: facebook/relay

Hi,

I'm getting the following warning:
In regard to
https://github.com/facebook/relay/blob/34f7c2360124c20503a3868e52a0ae9dabf1411d/packages/relay-runtime/store/RelayResponseNormalizer.js#L638

I'm getting the following warning

Warning: RelayResponseNormalizer: Invalid record. The record contains two instances of the same id: `RW50bmFobWVwcm90b2tvbGxQYXJhbWV0ZXI6MTc=` with conflicting field, optionen and its values:  and . If two fields are different but share the same id, one field will overwrite the other.

Warning: RelayResponseNormalizer: Invalid record. The record contains two instances of the same id: `RW50bmFobWVwcm90b2tvbGxQYXJhbWV0ZXI6Njc=` with conflicting field, optionen and its values: nein,ja and nein,ja. If two fields are different but share the same id, one field will overwrite the other.

Warning: RelayResponseNormalizer: Invalid record. The record contains two instances of the same id: `RW50bmFobWVwcm90b2tvbGxQYXJhbWV0ZXI6Mw==` with conflicting field, optionen and its values:  and . If two fields are different but share the same id, one field will overwrite the other.

for the query

query EntnahmenListQuery($probennehmer: String, $terminAb: DateTime) {
  entnahmen(probennehmer: $probennehmer, terminAb: $terminAb) {
    edges {
      node {
        id
        entnahmeprotokollDaten {
          edges {
            node {
              id
              entnahmeprotokollParameter {
                name
                optionen
              }
            }
          }
        }
      }
    }
  }
}

and this query result:

{
    "data": {
        "entnahmen": {
            "edges": [{
                "node": {
                    "id": "RW50bmFobWVuOjE0NTI2OA==",
                    "entnahmeprotokollDaten": {
                        "edges": [{
                            "node": {
                                "id": "RW50bmFobWVwcm90b2tvbGxEYXRlbjoyOTU0NTU1",
                                "entnahmeprotokollParameter": {
                                    "name": "Flaschen Nr. Mikro",
                                    "optionen": [],
                                    "id": "RW50bmFobWVwcm90b2tvbGxQYXJhbWV0ZXI6MTc="
                                }
                            }
                        }, {
                            "node": {
                                "id": "RW50bmFobWVwcm90b2tvbGxEYXRlbjoyOTU0NTU2",
                                "entnahmeprotokollParameter": {
                                    "name": "Kennzahl vorhanden",
                                    "optionen": ["nein", "ja"],
                                    "id": "RW50bmFobWVwcm90b2tvbGxQYXJhbWV0ZXI6Njc="
                                }
                            }
                        }, {
                            "node": {
                                "id": "RW50bmFobWVwcm90b2tvbGxEYXRlbjoyOTU0NTU3",
                                "entnahmeprotokollParameter": {
                                    "name": "Wassertemperatur",
                                    "optionen": [],
                                    "id": "RW50bmFobWVwcm90b2tvbGxQYXJhbWV0ZXI6Mw=="
                                }
                            }
                        }, {
                            "node": {
                                "id": "RW50bmFobWVwcm90b2tvbGxEYXRlbjoyOTU0NTU4",
                                "entnahmeprotokollParameter": {
                                    "name": "Temperaturkonstanz",
                                    "optionen": null,
                                    "id": "RW50bmFobWVwcm90b2tvbGxQYXJhbWV0ZXI6MjQ="
                                }
                            }
                        }]
                    }
                }
            }, {
                "node": {
                    "id": "RW50bmFobWVuOjE0NTI2OQ==",
                    "entnahmeprotokollDaten": {
                        "edges": [{
                            "node": {
                                "id": "RW50bmFobWVwcm90b2tvbGxEYXRlbjoyOTU0NDcx",
                                "entnahmeprotokollParameter": {
                                    "name": "Flaschen Nr. Mikro",
                                    "optionen": [],
                                    "id": "RW50bmFobWVwcm90b2tvbGxQYXJhbWV0ZXI6MTc="
                                }
                            }
                        }, {
                            "node": {
                                "id": "RW50bmFobWVwcm90b2tvbGxEYXRlbjoyOTU0NDcy",
                                "entnahmeprotokollParameter": {
                                    "name": "Kennzahl vorhanden",
                                    "optionen": ["nein", "ja"],
                                    "id": "RW50bmFobWVwcm90b2tvbGxQYXJhbWV0ZXI6Njc="
                                }
                            }
                        }, {
                            "node": {
                                "id": "RW50bmFobWVwcm90b2tvbGxEYXRlbjoyOTU0NDcz",
                                "entnahmeprotokollParameter": {
                                    "name": "Wassertemperatur",
                                    "optionen": [],
                                    "id": "RW50bmFobWVwcm90b2tvbGxQYXJhbWV0ZXI6Mw=="
                                }
                            }
                        }, {
                            "node": {
                                "id": "RW50bmFobWVwcm90b2tvbGxEYXRlbjoyOTU0NDc0",
                                "entnahmeprotokollParameter": {
                                    "name": "Temperaturkonstanz",
                                    "optionen": null,
                                    "id": "RW50bmFobWVwcm90b2tvbGxQYXJhbWV0ZXI6MjQ="
                                }
                            }
                        }]
                    }
                }
            }]
        }
    }
}

Apparently the array compare fails, is this a relay bug or should I treat the entries differently?

Most helpful comment

Hey all, no promises, but we are meeting internally this Friday to hopefully cut a new release. Stay tuned!

All 8 comments

This looks like a bug, the equality check should be deep equality as opposed to ===

Fix is pending

@josephsavona Thanks for this fix! 馃憦 Do you think it would be possible to release a patch/minor version with this change? I think we bumped into the same issue.

thanks for the fix, same question though: any chance of getting a release with the patch soon?

I realized that I'm having the same error. The ticket is closed, but the issue is still happening right? Has it been merged? Hopefully will be in the next release?

Hey all, no promises, but we are meeting internally this Friday to hopefully cut a new release. Stay tuned!

@josephsavona has a fix for this been merged? If so, is it missing from experimental? I'm developing using hooks/experimental and am still seeing this on 0.0.0-experimental-c818bac3.

@tslater This was included in 10.1.0 - could you share more info on what you're seeing / how to repro?

Was this page helpful?
0 / 5 - 0 ratings