Query - 'on start' event

Hello Team!

Is it possible to have additional setting for queries like event On start which would enable us to run another query, control component, set temporary state etc.?

Hi @heynoway,

You can 'chain' queries together in two ways:

UI

  1. In the Advanced tab of a query you specify that the query runs when the page loads
  2. Then on the main tab of the query you can add additional steps in the 'Success' section. By clicking 'add' you can specify another query to run

JS Query

  1. Create a JS Query and specify it to run at page load (Just like above)
  2. In that JS code you can trigger other queries to run like so:
query1.trigger()
query2.trigger()
etc...
1 Like

Hi @Ron_West

I know that I can use on success and on failure events. I would like to have something that would allow me, for example to display some component every time query starts. I know I can do this in the same place where query is triggered. If query can be started in multiple places then I need to duplicate all 'component show' triggers.

Hey @heynoway! Happy to try helping here as well. Just to clarify, do you want to only show the components after the query is done running or do you just want to show the components while the query is running?

If the former, then you could maybe set a temp state on success of your query and then in your components, you could reference the temp state in the Hidden field.

If the latter, I wonder if you could use the queryName.isFetching property!

Let me know a bit more about your use case so we can get you set up here :slightly_smiling_face:

Hi @victoria

Currently we have only On success and On failure. These events allow us to select all kinds of interaction: component, temp state, query etc.

The idea is to have a possibility to use all available actions before query starts. For example we could set some temporary variables based on busineess logic, trigger some other queries etc. I know that all of that can be triggered in parralell in the same place where we trigger our query. It would just make it easier in cases where one query is started from multiple places.

Hmm I think your best bet would probably be to set an intermediary step, like you described.

Instead of triggering your target query, you can trigger the intermediary step (e.g. a JS query that sets temp state and triggers the target query).

I filed an internal request for pre-event event handlers and will keep you updated on any progress! :crossed_fingers: