Double Click Issue

Hi everyone!

I’ve been having issues with double clicks and I tried two alternatives in the same workflow to prevent this. Unfortunatelly, it is still triggering the workflows twice sometimes (and it’s always when bubble is slow).

One of the workflows works like this:
1 - The user selects a equipment and click the button to Deliver it;
2 - The workflow runs a series of actions.

To avoid running it twice, I implemented this:
1 - Hide the button (first action in the workflow);
2 - Set a custom state tha turns this button into a non clickable element
3 - Do a search for the same type of record. I run the entire workflow only if there is no record created on the last 10 seconds.

STILL, sometimes I have duplicated records. Don’t know what else to do.

Here are some print screens:

Conditional when running the entire workflows search for the same record in the last 10 seconds

This problem happens only once every 1.000 records, but it still makes the inventory wrong.

Anyone with the same issue?

And, another thing that I realized is that when bubble is slow, this happens more often.

its possible it is because workflows are actually run in parallel

the entire category is called debouncing so you can do a search for debounce algorithms

you might be able to make it happen more often by putting a delay at the beginning of the workflow. that might make it easier to reproduce

maybe try this:
allow the workflow to trigger only when a custom state is not set
the first step in the workflow is to set the state
the last step in the workflow is to unset the state

within the workflow make each step a custom event that returns a value, use that value in the next step. This will force bubble to run each step in order.

In the long run if you cant get this to work, then you have to drop button click events into a queue and your workflow serializes access to the queue and kills all duplicates. Hopefully you wont have to do that.