Get notified when setFilter() has finished painting the table?

I would like to have the last row in the table selected after the filter is set (weird use case I know). I know how to select the row, but I need to know when Retool has finished all of the its filtering magic and has repainted the table and is now ready for my selectRow().

A better question would be how to know when the table finishes loading (under any circumstances) . I have another use case where I want to insert a row into a table (using a form, not the table) and then have that row selected. I have something working but I expect it will be unreliable:

1.Fill new data into form.
2.Run insert query.
3.Get the ID of the returned result (data.result[0].myidfield)
4.Run select query
5.Wait a bit
6.Select the new row

Here is my code:

// jsAddSaveSource
    onSuccess: function(data) {
      const sourceid = data.result[0].sourceid
        onSuccess: function(data) {
            additionalScope: {
              sourceid: sourceid

The jsSetSourceSelection query has a one second delay to let the table load the new data before running. This is the weak link in the chain:

// jsSetSourceSelection
const row = => element === sourceid)
if (row) {

Better ideas anyone?

Hey Bradly,

The loading state of the table should be tied directly to the query that is used to populate it, so triggering the row selection onSuccess of the query that is populating the table data should guarantee that the table is ready.

There is also an isFetching property on queries which can be checked to see if a query is currently running.