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.
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.