Now this is a weird one so I will keep it short.
I have used silent server calls for many months and always it supresses the spinner well. eg.
data = anvil.server.call_s('get_user')
So for tracking purposes for a moment I wanted to see things, so I removed _s to be normal call with spinner. eg.
data = anvil.server.call('get_user')
All good, spinner came back and I did my check. But now, I reinstate _s to original but spinner is always there now. I even cycled through my undo’s to go back to original code… but still I have spinners.
Is it a bug?
Thanks.
Cez.
This isn’t a full answer, just a troubleshooting tip: try setting a breakpoint before the server call and one after it, then run that line. That should help you see whether the spinner is really being triggered by that call or if the cause lies elsewhere.
1 Like
I just replied from my other account by accident, so apologies if the moderators get a little confused. The other reply went to “held for moderation” so it can be deleted if you wish. I will say the same thing here again to keep continuity:
I tried the breakpoints and it is definitely the trigger for the spinner.
One interesting thing is that I have the same line of code in a different form that’s been untouched for a while, and that is silent with _s (no spinner) fine.
This form we are talking about here was fine until I removed the _s for visual testing, and then put it back in again. It’s as if Anvil is completely ignoring the silent option now. I have also done the usual like clear cache etc.
Literally all I have done is removed the _s , tested, and put it back in again… nothing more, nothing less.
Thanks.
Just a guess, but which source-code branch did you do this in?
Hi, sorry I am not 100% sure what you mean. The app is not in production yet, it is all in development so everything is on the single main branch, single user.
If you meant something else please let me know and I will expand. Thank you.
That answers the question, thank you. There is only one branch.
We’ve seen situations before where a change is made in one branch, but users are running a different branch, so they don’t see the change. You’ve just ruled that possibility out.
If no one has any pointers, should I log this as a bug potentially?
The biggest problem is we don’t have a lot of details to go on besides that call_s is no longer working for you. When I run it in a test app, it’s working as expected:
Client Code
from ._anvil_designer import Form1Template
from anvil import *
import anvil.server
class Form1(Form1Template):
def __init__(self, **properties):
self.init_components(**properties)
anvil.server.call_s("test_server")
anvil.server.call("test_server")
def my_button_click(self, **event_args):
"""This method is called when the Button is clicked"""
anvil.server.call_s("test_server")
anvil.server.call("test_server")
Server Code
import anvil.server
import time
@anvil.server.callable
def test_server():
time.sleep(5)
print("server function complete")
In both the init and click handler the call_s is not throwing up a spinner and normal call is, as expected.
If you can share a minimal clone that shows the problem, you might get better responses.
Thanks very much for the reply.
I hear what you are saying about not being able to see what I can see on my side. Unfortunately I can’t share the app because it is a client’s. So I realise I am handicapping anyone trying to help.
The code is very simple:
def refresh_dashboard(self):
data = anvil.server.call_s('enum_user')
active_users = sum(1 for user in data if user['DenyAccess_bool'] is False)
self.label_23.text = str(active_users)
etc. etc.........
All I can say is that it is exactly as in my first post, ie. it was silent, I edited the call to not be silent, I edited it back to be silent but now it is always with a spinner, regardless. I have exactly the same call in other parts of the form and other forms which are all silent (but importantly have never been edited to be none-silent) and they all are silent.
I don’t really know where to go from here. It isn’t the end of the world, but I can’t see that it can be anything on my side because the issue is such a simple one. That is why I wondered if it should be reported as a bug just in case it is one?
Thank you.
Comment this line out. I think this is making another server call by accessing that field of the user row.
Thanks for the reply. I am away from the PC at the moment but will try it when I get back, but it is worth repeating that none of this code has changed. Before I changed:
data = anvil.server.call_s('enum_user')
to…
data = anvil.server.call('enum_user')
the call was silent, ie, no spinner at all.
The spinner has now only appeared after changing it to a normal call (which showed the spinner (correct)) and then back to silent (which should never show the spinner) but it does.
Nothing else has changed.
Thanks anyway.
Solved.
After I had typed my previous reply and mentioned about it seeming to be persistant, I went down that rabbit hole. I am using Brave Browser (Chromium-based) and although I had done a ‘clear cache’ from it’s menu I decided to reset Brave properly to default settings.
This has fixed the issue, therefore something in the browser was becoming persistant. I did in my preliminary tests a few days ago try the app in Firefox, but it was a little chaotic so decided I was introducing too many new variables into the bug hunt, by using a different rendering engine.
Thanks to everyone who replied.
Cez.
2 Likes