List item duplicate key, key not document_key

Encountering “children with same key” error message.
While making a list from a firebase table, somehow the key values are not sequential,
Is that expected behavior, to have a duplicate key like that?
How can I set the key to the document_key, or something else?

Hi, to my understanding the key is reserved name in React so it should come automatically for list and In this case should not come from backend. Is it possible that you have accidentaly stored field named key into one of the Firebase document?

That was it, thanks Antti!

Hey guys…

I’m still having this issue. I’ve checked and a “key” is not initially set on the Firebase backend, but it seems to be added to the back end each time ReactStudio updates the datasheet. It seems like the datasheet gets updates, then it updates firebase, which then causes problems with the page. I have about 21 errors on the page with only two items, which show up in duplicate (or triplicate, or more), or out of order, etc. Any ideas how to fix this?

Thanks!!

Here is a screenshot of one of the errors:

Ok… so I’ve been hitting my head against this for days, and the answer came to me only about ten minutes after I submitted this post. I was able to fix this.

The cause was that I was pulling data from two different queries on the same firebase field. The list of items came from one source (“my_brands”) which is a filtered list of those owned by the user, and the date on the details page came from another source (“current_brand”) which came from a source filtered by a specific brand_id. So… the datasheets had different numbers of elements in them, which is what was leading to the duplicate key values (as I believe the key comes from the length of the datasheet).

If anyone else has this issue, be sure to use the same datasheet when loading and saving data. :stuck_out_tongue:

1 Like