Showing results for 
Search instead for 
Did you mean: 
Level: Powered On

"Screen1" OnVisible UpdateContext timing issue?

To load data from an API data source, I am using an approach just like described here.  However, if I attempt to perform an UpdateContext in the OnVisible event from the very first screen when the app is loading, it never works.  If I create a "Screen1" with a simple button that navigates to "Screen2", and put my UpdateContext in the OnVisible of Screen2, it works every time.


So: doesn't work when loading the app, but works fine when navigating.


The only other clue I've found is this: just for kicks, I decided to try looking at the app on my phone to see if the Screen1 OnVisible would behave differently.  It still didn't work, but it did give me an error message about how I can't make a data call when not logged in.  ??  Naturally, the navigation to Screen2 still worked just fine.


So, that suggests to me a timing issue.  It's running the OnVisible before the app is prepared to actually make an API call.


It also suggests that we could improve the PowerApps Studio if it can't tell me about an error but PowerApps on my phone can...


Thoughts?  Ideas?





Level: Powered On

Re: "Screen1" OnVisible UpdateContext timing issue?

To help clarify what I think is a bug: this is not just about making an API call.  Here are the simplest possible reproduce by steps:


1. Create a new, blank app.

2. Add a control, like a textbox that says "Hello, world."

3. Set the "visible" attribute of that textbox to the context variable: isVisible

4. In your Screen1 OnVisible event, put UpdateContext({isVisible: true})

5. Run the app

6. Observe that your textbox is not there.


Now, add a second Screen with the same exact setup, navigate to it from Screen1, and it will work.


Something is not quite right about "OnVisible" on the first application screen.


Power Apps Staff AndyPennell
Power Apps Staff

Re: "Screen1" OnVisible UpdateContext timing issue?

OnVisible behaves differently in the Studio than it does in an app.

Level 8

Re: "Screen1" OnVisible UpdateContext timing issue?

Hi @AndyPennell,


Indeed OnVisible behaves differently in the Studio than it does in an app.  So, what is the recommended solution to make OnVisible fire on the first screen when not in the app?




Helpful resources


Coming Soon: T-Shirt Design Contest

Keep your eyes open for our upcoming T-shirt design contest!


Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!


Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

Top Solution Authors
Top Kudoed Authors
Users online (5,900)