Steps: I have logged the state and it shows correctly. but when i trigger the selectNewRow it resets to first row, i am assuming since the table has not yet updated with stated yet...?
i have the keep variable reference in sync on and that made the state keep in sync and the log proves that. But i have to have a small delay in order for it to work properly for now as a patch. But there must be something i am missing right?
Hey Paden, a Retool JS script is not async, so it won't "wait" when the await keyword is used when used at the top-level scope.
Instead you can return a Promise and use an event handler for code that should run after the asynchronous calls complete. Event handlers will be called after the Promise resolves.
And you'd add a Success Event Handler to this query that might look like:
table3.selectNextRow();
You can see more examples in our docs or check out this Community post for a deep dive into how to think about async functions when scripting in Retool.