Get a stack trace of how queries were triggered

Ah yes, I have used that. It has been helpful to me but often the graph of query dependencies is a little overwhelming and hard to decipher unfortunately. I put up a feature request a while back with some ideas to supplement the graph and put some order into it.

The query timeline is also helpful, but it only shows what was triggered when, not what triggered what (which onChange triggered a js query which triggered a sql query that triggered another query onSucess and so on.)

What I learned is to avoid this impossible to trace chain of queries and do one of two things:

  1. Use stored procedures. If I have logic where a query adds an invoice and another adds related line_items and another updating a status and so on, put that all in a stored procedure (or make an API end point if I am not using an RDMS). DO NOT try and do all of this in Retool.

  2. What l do keep in Retool, I encapsulate all of the logic into a js query using the async pattern for calling queries: Detect query failure when using async/await query.trigger() pattern - #6 by mark . This gives me control over what happens when.