I have a button that triggers a complex backend workflow, with the final action being the creation of a new thing in the database. I need to implement a spinner/loader in the front-end to indicate ongoing activity in the backend until the workflow is completed.
How would you approach this in Bubble?
Thank you in advance!
a cheap way to do this is to create a field on user called “loading”. When they click on their post // submit button, you can change the field in the front-end before scheduling the backend workflow.
Moreover, when user’s ‘loading’ is yes, conditionally display a front-end group that functions as a loader.
Lastly, in your backend workflow, just add a step at the very end of it, after everything is done, to make changes to user’s loading, and set it to ‘no’
You can also use, “do when data is changed” workflow if you want to be able to specifically perform an action when the workflow finishes, as oppsed to just showing and hiding groups.
Just make sure that the “field you’re watching” is user’s “loading”, and then you’ll be good to go.
I would set up an API call to your backend workflow using the API connector and return data from API (return the new thing created in the database). Instead of schedule API workflow, run this API call action and disable the loader when the result of the action is not empty.
I use this method particularly for signup backend workflows (data creation that occurs when a user signs up) as it can take a few seconds and I don’t want the user to be navigated to the dashboard until it’s completed.