Forum Academy Marketplace Showcase Pricing Features

[solved.] Only run workflow when page is 'active' or 'has focus'

Hi All,

I have some ‘Do every ‘x’ seconds’ workflows on a page and was wondering if there is a way to set an additional condition so that they only run when the page has focus.

I’m concerned that if someone opens the page and then leaves the page open in a tab or window before taking an action that stops the workflow that it will just continue to run in the background and eat up the workflow count.

Does Bubble automatically do this or is this something I need to set myself?

Cheers
Lyndon

Hey Lyndon :slight_smile: just curious, what are the workflows that are happening every five seconds? If they’re not server-side changes then they don’t count against your workflow count. Is this for a messages page? (Ex: Do a search for new messages every five seconds)

Hi Faye,

Really?? I must have missed that somewhere along the line.

My workflows are really simple and don’t change the database at all. I have 3 conditional workflows that run ever 5 seconds and animate different elements on the screen as the user steps through the process. They are set-up like a guided walk-through.

1: When the page first loads, if the count of sections is 0, an ‘Edit’ toggle animates (bounces) every 5 seconds until the user clicks it.

2: When that toggle is clicked, a ‘Manage Sections’ button bounces every 5 seconds until it is clicked. When clicked it sets a state on itself to ‘clicked’ and stops.

3: Create a new section button bounces every 5 seconds until it is clicked.

So, yes - it appears these are not server side changes. That is very good news… :slight_smile:

Thanks Faye.

2 Likes

Ah, gotcha! Yes, all of that will not count against your workflow count. No problem at all :slight_smile:

That’s excellent!

Cheers

HI Faye,

Can I just confirm 1 thing on this?
So as long as I am not writing to the database, the workflow is not counted? Querying against the database is not classified as a server side action?

Cheers
Lyndon

Yes, I believe that’s correct since workflows are only counted for “data operations”. If you have a workflow such as “When Button is clicked and Do A Search for X is… --> Show Element Y” then that would not be counted as a workflow. But, if it was “When Button is clicked and Do A Search for X is… --> Create A New Thing” (for example), that would count as a workflow. I just double-checked by seeing if any workflows were added to my Total Workflow Count after just a query and the count did not increase. :slight_smile: :+1:

Great. Thanks Faye. I just realised I could have tested that too. Forgot about the workflow counter… Thanks again for your help :blush:

1 Like

No worries at all Lyndon! :blush: Great question to double-check!