Difference between state of selected row and table data

Hi!
I have some functions that rely on a specific selected row in a table. One of these broke recently and I don't understand why. When I update the "status" in the below screenshot I get an odd difference between that selected row within the table and the actual data in the table.

The selected row does not change, while the status of the data in the table does.
When I reload the page this is fixed. How can I make sure the selected row data stays live?


Is the table configured to have a multiselect option?
Can you share the configuration of the table?
When you say " When I update the "status" in the below screenshot", what do you mean?

Hi Scott, sorry missed your reply.

No, multi select is not on. No primary key is selected either.

So the screenshot leaves the status column's visible. I use the table to show some information about 1 order at a time (the table has one row every time). Orders have statuses in our system, we can use retool to move an order between them. As an order moves from one status to the next, in this example "PUBLISHED" to "CHOOSING_OFFERS", the error occurs. The table visually shows the next status "CHOOSING_OFFERS" but the .selectedRow still holds the value "PUBLISHED". Our database also correctly shows the status ""CHOOSING_OFFERS" so it is a problem with the .selectedRow value.

Hope that clears things up :slight_smile:

Hello, are you updating status? and refreshing table in a separate tab?

in here i update record's name while table is in tab1 (View 1), you can see that table data name is Thor Mer, but selected row stills Thor Mercer.


Is a known issue that selectedRow doesnt update till you re-select the row

Hey Oscar, this is the exact problem I have indeed. Is there any fix?

The status is refreshed from modal that originates from the same tab that the table is in. However, I'm not sure if that has a different effect.

my workaround to this is to work with a transformer

e.g.
Transformer

const client_db = {{ getClients.data }} //
let index = clientesDatos.id.indexOf({{ table1.selectedRow.id }})
let selectedClient = {}

Object.keys(client_db).forEach(key => {
  selectedClient [key] = client_db [key][index]
})

return selectedClient 

by this way the transformer will always contain the updated data since its returning the data from the database and not from the table

1 Like

Thanks for sharing a workaround! This bug is scoped to cases where the table is hidden, such as being in another tab. We'll post here when our team is able to ship a fix