cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
charleswstanton
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?

 

Respectfully,

Charles

 

3 REPLIES 3
charleswstanton
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.

 

PowerApps Staff AndyPennell
PowerApps Staff

Re: "Screen1" OnVisible UpdateContext timing issue?

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

haniel
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?

 

Thanks,

-Haniel

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,993)