Is there a way to async/await a GraphQL Resource

Loving the tool so far. I've built a simple Master / Detail screen with 2 tables. In the Detail table I've added a modal button/popup for adding new records and a remove button for deleting. They work fine. The problem I'm having is refreshing the Detail table query after the Mutations of adding or removing. In the Event Handlers I added a trigger for the Detail query after the Mutations, but it is running too quickly, and executes before the Add or Delete Mutations are finished, therefore the Detail table is not refreshed. Is there a way to do something similar to an async await on GraphQL Resource Mutation.

Hey @nsteblay!

Event handlers attached to the same event will typically all run at once, so usually, I'd recommend adding the handler that refreshes your table to the Mutation query itself rather than on the table itself. If that's already what you're doing then sorry for the misunderstanding! :sweat_smile:

That being said, you should also be able to use async/await with any query as long as you're triggering it from a script! You might try a script event handler that does something like:

await mutationQuery.trigger();

Or, if you're running multiple mutation queries:

await Promise.all([mutation1.trigger(), mutation2.trigger()]);

Do either of those work? Or do you find that it still runs too early?

Thanks for the response. I found the Event Handlers for Success and Failure that met my needs.