I was making some changes when building a loading screen and now when I re-open the editor to work on the App, the OnVisible function executes and eventually causes it to crash as it tries to load Data.
It its a relatively large data set that It collects in iterations. The intention is for that it can be referenced Offline so it utilizes the SaveData and LoadData functions.
It works fine on the Device as it has somewhere to store it, and it had been working fine when actually running it in the Browser with the SaveData and LoadData experimental features enabled.
But now that I have changed it to executing with a Loading Screen utilizing OnVisible (instead of manually with a button as I had been doing), every time I open the App the OnVisible executes before I can click into anything to make changes and locks me out while it attempts to Load or Save Data.
I really dont want to roll back the App Version as I have been having issues with PowerApps all week, earlier this week it wouldnt let me click on a certain screen and it kept booting me back. Couldnt delete the screen or anything and had to restore older versions where that screen didn't exist.
Having tried different browsers, reboots, CtrlF5s, Cookies, different user accounts I am now playing with trying to export the app and unpack it and try to comment out the OnVisible functions in VSCode and try to reupload it, but currently not having alot of success reuploading it. When I unpack edit and repack the MSAPP file that comes from an export it gives me an error when I try to upload it again.
I had only played with this previously by selecting File -> Save to Computer and then File > Open > Browse and Select the MSAPP file. But I cannot click on File as it freezes up before allowing me to do anything when I open the App.
Quite Literally found a work around that occurred to me after and due to me writing this out.
I had to Export the App, unpack and edit the OnVisible property of the Loading Screen to stop it from trying to LoadData, then save and pack it up.
Then instead of trying to import the whole zip file which had not been working, I just made a new blank app,
File > Open > Browse and selected the .msapp file that I had repacked after commenting out the trouble lines of code.
Leaving this post up hoping someone can explain or recommend just what a person should be doing as to this problem or if it can be addressed. I will attempt to try and problem solve a little more here but I find this a bit ridiculous that the editor insists on trying to run all these OnVisible functions when NOT in Play mode or holding the Alt key.
I will search through some settings and see if there is anything I can enable/disable to avoid this behaviour as I do not recall this being an issue for me before.
Hi @pompousROB ,
One workaround is to add a welcome screen with nothing OnVisible so the App won't load data when it's open in studio or on devices. And you will be able to disable those functions in settings before editing the App:
Just need to remember to enable this setting before saving and publishing.
Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.
Having moved on from my initial problem I managed to experiment a little more. I tried toggling the Enable SaveData, LoadData etc feature on and off. Also tried inserting a different Blank screen, as well as Setting up App.StartScreen to initially navigate to a different screen. Even tried the older method Navigate(*screen) in App.OnStart and enabled that retired feature. These all helped with the fact that I could now open the project. but as soon as I clicked on the Loading screen that I had built with the OnVisible function that was causing problems it would execute and then crash.
One thing that worked was to use a Timer with a very brief duration, OnVisible would start the timer and the original code that was in OnVisible would then execute from OnTimerEnd. This appeared to hault the automatic execution of the code when working within the editor as the function wouldnt run when the timer ended unless it was in Play mode.
Unfortunately and unexpectedly this didnt relay well to performance on my device.
I noticed that it was only on the INITIAL navigation to the Loading screen where this crash would occur, and only from 1 out of the 5 button functions that are supposed to run.
The workaround that I found to work best for me is to simply comment out the code that runs this button when I stop working for the day. I can save > publish with the code enabled, but when I intend to close the browser I need to disable it so that I can reopen it without it running. When it is opened in the editor I can uncomment the code and navigate between screens in the editor freely, and although it runs OnVisible, it doesnt result in the infinite loop scenario I had before.
Keep up to date with current events and community announcements in the Power Apps community.
A great place where you can stay up to date with community calls and interact with the speakers.
Check out the latest Community Blog from the community!