"Do When" a great option or a last resort

Hey All

As always Im constantly looking over my app for performance tweaks. I am using a lot of reusable items which seams to work well however it often becomes an issue to get the data I need out especially when using nested re usables.
One way I have thought of to get the data out is to use “Do Whens” set to always and having a trigger in the database.
As I mull over this more and more I can see more and more instances to use them.

However I’m wondering if there is a tradeoff. I’m assuming, and I really dont know, that a “do when” set to everytime would take some cpu as it would always be monitoring (is it always monitoring? or does it work some other way) for the condition. If so having say 30 of them might start to detract from any performance i might gain from using the re usable elements.

So I guess my question is other than to discuss another not so much discussed feature of Bubble is “Is a “Do When” slower than running a direct workflow, and when used often does it take up rescources?”

Excellent question and despite being a newbie, it’s something I’ve been wondering too.

We treat “do when” as a last resort. The reason has less to do with CPU stuff (I believe it affects performance but not much, similar to how a conditional formatting statement would affect it) and more to do that it’s harder to debug and maintain. With workflows that happen upon a user action, it’s easy to see where things are going wrong and it’s hard to forget about something that happens as a result of that action because it’s all in the same workflow.

That being said, “do when” can be super useful in certain instances, like when whatever you want to trigger your workflow is not actually happening on the user’s page. For example, if you want a notification to show up for a user in real-time when another user sends them a message.

Vlad
AirDev

2 Likes

Thanks Vlad its great to get an expert opinion