List / Grid - other Row-Components losing state after insert new Row-Component in Data-Table

Hi,

I am currently using the Firebase plugin to display data from a collection in a sorted list with an index. The list uses a component with several states to display a line. Currently I have a problem when a document is added to the collection when the new index is not at the end. The new line is added correctly, but the current lines do not keep their current states. At the moment it is becoming apparent that the contents are displayed in the correct order, but the original states do not move with the data lines.

The following can be used as an example. Before inserting a new line, the list has the following status, for example:

Index 1: State 1
Index 2: State 1
Index 3: State 2
Index 4: State 2

if a new line is now inserted between index 1 and 2:

Index 1: State 1
Index new: State 1
Index 2: State 2
Index 3: State 2
Index 4: State 1

So index 2 and 4 have got a wrong state. I would be very grateful for your help at the moment.

Best regards

Michael

Hi,

The item state is probably stored in the list item components so this use case is problematic. I’m not sure if even the “Refresh data sheet” interaction would fix this.

We’ll investigate couple other Data plugin issues at the end of this week and will let you know if there is a quick fix available for this.

Hi,

are there any new messages regarding the problem? I have investigated the problem further and found an error with return (<li key = {row.key}>. The list from the Firebase database is ordered and therefore a newly inserted element gets the row.key of the previous one and thus also its state. Isn’t it better to use the document_key for row.key from Firebase, which remains stable?

An attempt to use a Transformer script for the list and thus set row.key to document_key helped with the state problem when adding a new row, but updateInDataSheet no longer works.

Help would be very welcome!

Hey

I found a solution. In Firebase_Reactstudio.plugin in the file DataSheetWriteOverrides.js, line 19, a key is explicitly removed when the line is added:

let parsedItem = (({key, document_key, document_path, … item}) => (item)) (item);

This removes the possibility for a programmer to generate his own unique key. After changing this line to the following, the states of the lines are now consistent:

let parsedItem = (({document_key, document_path, … item}) => (item)) (item);

Best regards

Micha

1 Like