How can I trigger an event while API connector is loading

I am using the API connector to fetch some data from an external source. How can I trigger an event while the API connector is waiting on the response? An example would be, I would want a spinner to show while I am waiting on a response.

If the data was on bubble, I can do so with a conditional, while repeating group is loading, but there is no equivalent when the data is being fetched from API connector

2 Likes

Bumping this. I also noticed the default loading image doesn’t work on the repeating group when you’re using an API call.

Did you ever figure this out?

Its a bit of a hack but you could create a state in the repeating group called diplay_list
Then put a field in your user called api_is_loading
create a workflow such as
modify a user, api_is_loading = yes
set state display_list = get data from api
modify a user, api_is_loading = no

create an icon, group, text whatever you need and set a condition that its visible when user, api_is_loading = yes

the workflow could be a custom workflow where you can pass parameters and it could be connected to a button, searchbar or run on page load

2 Likes

This is a great idea!

I tried something like this but it was only for a single repeating group and I thought I would have to manually recreate for each one.

Now I can just put a pop-up in the header and whenever an API call is being made it will trigger the pop-up. Still a bit hacky, but definitely a much better approach.

Thanks!

From memory a pop up won’t work cause you can’t close it conditionally you need an actual workflow to hide it
Pop up obviously would be the first choice cause it blocks out the rest of the screen
Could possibly create a “do when” workflow
Obviously do when api_loading = no or similar

I ended up using a workflow because my repeating group has images and I realized that when I just show/hide it the old images take some time to update. So instead I use clear list and display list.