I have a server function which puts in a call to an external api. I was expecting to see the blue spinner when I call it from a form until it returns a value, but that’s not happening.
Do I need to explicitly state that I want the spinner somehow?
I have a server function which puts in a call to an external api. I was expecting to see the blue spinner when I call it from a form until it returns a value, but that’s not happening.
Do I need to explicitly state that I want the spinner somehow?
Not sure there’s anything built in for external api calls (like the anvil.server.call_s for form to server calls), but see this thread here, which shows using the “with” python statement to show a notification for the duration of running code. It might help :
The external api is only called within the anvil server function. My understanding was that using ‘anvil.server.call’ within a form, I’d get the spinner. I wasn’t expecting to have to use a notification at all.
Have I just got that wrong?
i.e. I thought that if the server function takes time to return (for whatever reason), the spinner would show when that function is called.
Based on the description of how to disable that feature in How to remove the blinking blue dotted circle?
(Sorry, I misread your initial post)
If you call a server function with
anvil.server.call("funcname")
from a form then you should see the spinner (assuming the call takes long enough to complete for it to appear, that is).
Are you not? If so, any chance you can recreate that in a small app and post the link so i can clone and test? It works perfectly here for me.
It does work for most cases - it’s just when the server function calls an external api that I get no spinner. If I replace that external call with a time delay before returning a dict, the spinner appears.
Sussed it!!!
The form from which the function is called is opened as an alert. The spinner is appearing, but it’s behind the alert. If the form is small enough, I can see the spinner in the background.
Aha, thank you! We’ll get that fixed in the next few days
(Moving to Bug Reports)
assert ‘external api’ == ‘red herring’
Correct; the issue is the spinner appearing behind the alert box. We’ll get that fixed.
Sorry, that wasn’t question. That was supposed to be me slapping my forehead with my hand because I had been chasing a red herring for so long.