Target Multiple Queries by Folder

Sometimes, you need to trigger multiple queries at once. While you could do something like this:

queries = _.each([query1, query2, query3], (query) => query.trigger)

...this approach quickly becomes difficult to maintain, especially when query names change or some become unavailable.

To simplify this, I thought it would be useful to reference an entire folder and target all underlying queries automatically. Something like this:

MyFolder.queries // [query1, query2, query3, ...any other queries]

This way, you could handle all queries collectively. For example, to clear their cache, you might do:

_.each(MyFolder.queries, (query) => query.invalidateCache());

Curious to hear your thoughts on this! :rocket:

Thanks! :wave:

I could also imagine allowing for a more direct approach in the case of .invalidateCache, that would allow users to simply refer to the folder and invalidate any caching that may be involved. Something like this:

MyFolder.invalidateCache() which would take care of this behavior automatically.

1 Like

Hi @emozio!

For the case of clearing any query caches and folder targeting, I can definitely see the usefulness of being able to reference all queries in a folder and have the code behind the scenes iterate through each of them regardless of any name changes.

Let me make a feature request for that right now!

Looking at the first post, I was about to write out a long response as to how Javascript is single threaded, and race conditions but I am sure you already know all of that fun stuff :sweat_smile:

Got word from the engineering team that this is a good feature request.

They have moved this ticket to 'needing design' to have the front end UI be built out. Will continue to promote this ticket and check in with the eng team and forward along any updates I get :+1: