What data are you setting in table1? I would suggest you add a return data on your JS Query and then add {{query1.data}} on table1's Data field. I do think you need a data reference point for the component. You can check the left panel (cmd+b or ctrl+b) and go to table1. You'll see that data is null hence your TypeError message.
Set Data overrides the records in the table but it only works if you have already store a main data point in the component. I.e. query1.data is referenced by the table component and then create query2.data for setData which alters the value of table1 component.
On logging into console, you can add a console.log(text) in your JS Query. When you run it, make sure you have your dev tools up on your browser and click the console tab. It writes the text, query name, and the line number (with added count since it is being wrapped by retool).
Thanks for the quick response. The demo query does work and written to demonstrate the problem. I want to test the table contents after setting them. It is the testing tool I want to work.
Hope this makes sense II
P.S. I should add, I know you can do console.log for JS querys but for the Unit Testing this does not work or I am doing something very wrong
@bibble235, oh lol, it's on beta testing still. You might want to ask those who brought you in to test the feature. I have the same for workflows (another feature on beta, much like zapier). So yeah, I'm too assuming I could help here haha
Hey all, I'm chiming in from support here @jocen thanks for stepping in to help @bibble235 I've tested this out on my end and it appears to be working correctly.
I want to test the state of all of the controls after running the script. This is a demo to convey my intentions. Let me know if you want the JSON export.
Hi bibble235, I'm sorry for the very long delay here.
In line 2 of your test the await query1.trigger() resolves before the promise chain on lines 28 - 32 of your query resolves. However, this looks like a bug on our end since waitForCondition should continue testing for success, and allow this promise chain to resolve before returning a failure. So waitForCondition is clearly not working as expected here. We've passed along a report of this to engineering and I'll let you know of any updates on the issue. Thank you for flagging this for us!
In the meantime, if you add an await in front of your promise chain on line 28 then your test should work as expected.
Hey bibble235, top-level await in JS queries is a feature that was added in a recent Retool version. Can you share what version of Retool you're running, it's likely that you don't have this feature yet?