I have several workflows in my app that have conditional actions. All else being equal, is it better from a performance perspective to have multiple workflows, each of which will only be run under certain conditions, or to have one workflow with many conditionally run actions?
For simple workflows, I have not noticed a difference but am currently in the process of trying to speed up some of my slower workflows and would like to know if this would be a fruitful route to pursue.
Iāve found that itās usually best done on the Event level (Button A is clicked and only whenā¦) if the conditions donāt rely on the actions themselves like a User A/B Type action
If you do it on the action level and just having a singular Event, the workflow runs through every action every time even if most of them donāt meet the criteria. Instead if you have it on the Event level, you pre-determine which set of actions will be ran
Thanks @peng.o that makes a lot of sense, especially because some of my work flows require a search in the conditional, I realize now I was probably running that search multiple times which was a huge drag on performance, Iāll probably start moving all that out to the workflow level.
Additionally, weāve found thereās only 1 drawback with this approach - sometimes it takes a while for the first action to be triggered (because Bubble is checking which workflows to run first).
When thatās important to address, weāve found a more advanced solution that solves for this without sacrificing performance. The approach is to have a single workflow run when the user clicks the button (no conditions on the workflow), then include a set of āCustom Eventsā that are conditionally triggered within that workflow. As such, you could also include actions that always run before or after these custom events (e.g., for example, update a custom state to make the button text a font-awesome loading icon).
Just FYI for anyone coming across this wants that immediate feedback to the user that the button has been clicked and the app is processing their request.
Thatās a very intriguing idea. Iāll have to keep that in mind for the future. I have not played around much with the custom events yet except for the āon input value changeā so that is definitely an area of bubble I should start exploring.