Why some forms keep buffering?

as the picture shown, when this form shown, it would load data from data tables. However, this form keep buffering, looks like there are a lot data loading, actually, all data are there! and there is no problem to check data that need to be added into other forms, why was that?

The spinning blue circle is due to calling server functions from the client.

Can you share a clone link of the app?

Otherwise, try adding some print statements in the relevant server calls to determine where in the code you should look.

Keep in mind that the DataGrid does not show all rows on the screen, so perhaps the data are still loading in the background. For example, you can see here a DataGrid that will only display 20 rows at a time. That might not be your issue, but it is worth checking.

sc1

If you can, please share a clone link of the app.

1 Like

thanks for suggestion, I fixed it already. I had bad code when the form was shown.

It is always helpful if you can explain your solution so that others can benefit. Glad it is fixed.

I’m just patiently waiting for the buffer to end to see what happens, and it turns out that the memory is full ! simply because of this stupid code of

user = anvil.user.get_user()
if user is not Null:  # I logged in at the moment
    self.button.signup.visible = True
else:
    self.button.signup.visible = False

then, I correct them into

if user is not Null:
    self.button.signup.visible = False
else:
    self.button.signup.visible = True

Problem solved!

Hmm. I’m actually surprised that code was responsible for the constant buffering (server call). I can’t personally see the connection. Anyway, glad it is working.

May I politely suggest the DRY version?

self.button.signup.visible = (user is Null)

has exactly the same effect as

if user is not Null:
    self.button.signup.visible = False
else:
    self.button.signup.visible = True

The two are interchangeable.

1 Like

initially, ā€˜self.button.signup.visible’ was True, at the moment of user logged in, ā€˜user is not Null’ is True, then server keep executing this code of ā€œself.button.signup.visible = Trueā€ .

similar like:
a =1
if True:
a = 1
else:
a = 0

you may try that, I am not fully understanding the principle , but the code is not logical.

I corrected my shorthand code, and expanded the explanation.

Nice! Thank you, it would save a lot code!