How to reload all queries by code

Hi Retool Team,

In the Retool UI, at the top right corner, there is an option to reload all queries of the all. Is there a way to trigger it via JS code, please?
Screenshot 2021-06-04 at 15.02.52

Thanks,
Oliver

@victoria sorry to tag you on this directly...just want to give it a bump

@oliver.ng you can create a JS-based wrapper query.
In that wrapper query, you can trigger queries like this

yourFirstquery.trigger();
yourSecondquery.trigger();

and so on.
After that, you can call the wrapper query according to your need.

For more details about how you can pass variables and receive a response from the queries in JS please have a look at the following documentation link.

I wonder if there is any kind of reflection available where we could programmatically get a list of all queries, components and such - @justin or @retool_team (I poked around under the hood looking for Retool's "engine" but that appears beyond my abilities)? Then you could get the list of queries and loop through them. No need for code changes if you add a query down the line.

If you only wanted to refresh certain queries then give them a unique naming convention (all queries that end with _refresh)

If you had access to the query's entire model, you could filter queries that only did a SELECT a particular list of tables or only those that used a particular Resource Type (The model surfaces the resource type using the pluginType property but I don't see the actual resource name)

Hi all, thanks for this feedback! I will share this with our team internally 😊