How can I check if the app has been fully loaded before leting the person use it?

I’m developing an app and I hope that some people with terrible internet connections can use it( like around 40 kbps per second). I’ve been running some tests with the Anvil tool and noticed that it allows users to interact with the app before it’s fully loaded, which has been causing some bugs. Is there a way to prevent or check for this ?

I’ve been trying a method where I check if certain items on the page are already present in the app, but it hasn’t been working.

  def check_app_loaded(self):


    a = False


    if (not(self.image_1 == None)) and (not(self.btn_gerar_recomendacao == None)):
      print("Loaed!")
      a = True
    else:
      print("not Loaed!")
      a = False    
    
    return a
 

I usually start with buttons et al disabled (.enabled = False), and enable them only after enough of my startup data has arrived.

how can i check how much sartup data has arrived?

In my case, I make server calls (anvil.server.call) to fetch that data. Those calls only return when the data transfer is complete. So once execution reaches the line of code after the call, I know that the data has been received.

Edit:
On a really slow connection, I would ask for the minimum amount of information needed to get started. Then, using a Timer, I would schedule calls for the remaining data. This turns out to be a very popular technique.

1 Like

i will try this, thanks

Didn’t work exactly as I expected or wanted, but it works