Execute conditional rule before workflow ends

I have a workflow that starts by clicking an “add button”.

  1. Step 1, adds a value to a state list.
  2. Step 2, make an API call.
  3. Then other stuff.

The intention was that products in that stat list would not be clickable once added.
So I made this conditional statement:

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:
ezgif-4-2bdb77caae

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

  1. user selects the products
  2. user confirms selection (multiple products)
  3. on confirm do the api calls in the backend to fetch the data (can use api on list)
  4. show a loader whilst the data is fetched
  5. 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.

Thanks. The option to add a confirmation won’t work for this use case.

How would you utilize the backend workflow to implement the alternative option?

Note: I don’t use Bubble DB; everything is on an external database, hence the API calls.

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.

put that first action to set state into a custom event which should force it to run and complete before other actions run

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

It still processes everything synchronously…

This topic was automatically closed after 70 days. New replies are no longer allowed.