"When page is loaded" that works when it is not the page's initial load

Hi,

I want to make something visible when my page is loading (loading a workflow, not the initial load of the page) .

However, using the "When page is loaded (entire) " conditional to make the element visible does not works, since this conditional apparently refers to the initial load of the page.

Is there something like “When page is loaded” that works when it is not the page’s initial load? I mean, when the top horizontal loading bar is loading

I spent a lot of time looking into this when I wanted to show a small loading animation when a heavy workflow was running and I couldn’t get anything to work reliably. I guess that’s what you’re trying to do as well?

My workflow was really consistent and most of it was happening server-side so my workaround was to just show my loading element after the workflow was triggered, put in a delay for x seconds and then hide the loading element. It worked pretty well as I over-estimated the time for the workflow to run to allow for a margin of error. But it’s far from perfect and very much a hack.

This approach really doesn’t work if a lot is happening client side though, as loading times can be vastly different depending on a bunch of factors, so you either have to cater for the worst case and make everyone wait or look for something else.

The thing to remember here is that step n+1 can start before step n has finished processing, which is great 99% of the time but annoying in this situation if step 5 is hiding the loading element but step 2 is still churning away at completing what it needs to do

As an aside there is a really interesting tidbit in this article if you checkout the TurboTax example

The most ideal situation is the heavy part of your workflow does something (rather than say querying a big db to feed a repeating group) and you’re able to use that as a trigger to hide the loading animation. i.e. If your workflow was pulling data from an API and creating new records, well you could look for when those records hit the DB (maybe with a short delay) to hide the animation knowing that everything would be complete.

Sorry - a lot of rambling but I hope this is useful to you. As I said - I spent a lot of time trying to nail this and I tried many ways. Each had their own flaws and the right answer really is an annoying “it depends”

Josh

2 Likes

Hi Josh, this info is really helpful!

I’ll try the different alternatives and see which suits me better.

Hopefully one day Bubble can add a conditional for this loading state.

Thanks!

1 Like

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