The conditional rule executes only after the workflow completes, processing each “add click” sequentially, which slows down the process due to the API call involved:
How can I make the conditional rule execute immediately rather than waiting for the rest of the workflow to finish?
move the api call to the backend since it takes so long to process… you don’t want users to have to wait or risk going to another page before it completes
if you need the information from the api call to set the states content then you’d be better served to prefetch and store that info in the database so it is immediate and they don’t have to wait 12 seconds
The API call is essential to show some stuff on the page.
It needs to correspond with the specific product the user “adds”.
The user clicks add → product card is not clickable → API call retrieved product’s “stuff” → a new product card with “stuff” pops at the bottom page.
give that then you will need to find a way to inform and distract users
the api call can be sent to the backend and still show stuff on the page (provided you’re creating things from the result)
I’d recommend breaking this process down for the user into steps
user selects the products
user confirms selection (multiple products)
on confirm do the api calls in the backend to fetch the data (can use api on list)
show a loader whilst the data is fetched
reveal the data to the user
if the api is not expensive or limited then you could fetch the data in the backend when they add the items (rather than on confirm) - this would speed up the “reveal” step for the user.
if the rate limit is high you could likely request all the products at 1 time from the api so they all fetch together rather than sequentially. although the prefetch is likely the better method.
If goal is to make something not clickable while you process something, on click set custom state to a yes value and have condition for thing to not be clickable when custom state value is yes, then have action to set custom state value back to no after processing has finished.
I’m doing something like that.
On click it adds the product card ID to a custom state list.
The card has a condition that it’s not clickable if its ID is in that list.
But it doesn’t execute until the API call and the rest of the steps in the workflow are finished.
Which makes the UI delay look very bad.
In a workflow with two actions, if Step 2 is using a condition based on a search depending on data manipulated in Step 1, then Step 1 should be implemented into a custom event to make sure it is finished before moving on to Step 2