How to run both the event handlers in a button on a single click

i added 2 event handlers but when i click the button only 1 runs and i have to click a 2nd time for the 2nd event handler. How do i make it run both the events on a single click?


Hey @ritvik_singhvi!

Would you mind sharing how each of your event handlers work?

I'm wondering particularly if they need to be run sequentially, handlers added to a particular event will typically run at the same time, so it might help to use a script event handler that does something like this to ensure setData completes before the query is triggered:

await component.setData();

one event is to query1.trigger and the 2nd event is to set the data given from query1 .

I see, in that case, you might try something like this:

const data = await query1.trigger();

Or, add your setData handler to the success event of the query that's being triggered:

Can you let me know if either of those work?

hey the first one worked thanks!