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.
@evan-retool, I feel a little differently. it would seem like edit_part.trigger() is a promise. You seem to be saying that Paden can't await it. But you're putting it in Promise.all, that suggests it is a Promise, and if it's a promise than they should be able to use it with await.
At least that would be how regular Javascript would work.
Also it seems possible that Paden wants edit_part to run and finish before add_part whereas promise.all is going to start them both at the same time.