Canvas Apps Performance

OnStart – How to optimize app loading experience!

App's OnStart property in Power Apps
Apps OnStart property in Power Apps

Introduction

The OnStart property runs when an app starts. There are multiple use cases when it makes sense to place the code in the app's OnStart. For example,

  • Setting up global variables e.g. for colors that will be used throughout the app
  • Fetch and store records in a collection e.g. for offline capabilities

To read more about the App control, click here.

Tip - Start & end of OnStart!

Depending on your app, you could have a lot of code in OnStart. If so, set a variable to false at the beginning of the OnStart and then set it to true at the end of the OnStart. A pretty standard pattern is to have a loading screen that redirects users to the welcome screen. For that you will need a timer on the loading screen to navigate the user to the welcome screen. It is a good idea to make sure that all the collections and variables have been set before the user gets to the welcome screen. A simple way to ensure that is to check if the variable that was set at the beginning of the OnStart is true and only then navigate to the welcome screen.

Here is a quick summary:

App's OnStart:

Set(gblAppLoad, false); [other code here]; Set(gblAppLoad, true)

OnTimerEnd of the navigation timer on the loading screen:

If(gblAppLoad, Navigate('Welcome Screen'))

Stay tuned for the remaining 11 tips!

Recent articles

  1. A-Z: 26 tips! Learn how to improve your Power Apps!
  2. Add Picture vs Camera Control – Who is the winner?
  3. Background images for Power Apps screens – the right way!
  4. Combo box or Dropdown? - Who is the winner?
  5. Delegation in Power Apps – How to identify and test!
  6. Edit vs Display – Which is the better form?
  7. Formulas – How to learn the 170+ Power Apps formulas?
  8. Galleries vs Data Tables – How to pick between the two in Power Apps?
  9. Hyperlinks – How to launch web pages & apps in Power Apps!
  10. Icons – How to increase performance!
  11. Jump start – How to speed up Power Apps dev with components!
  12. Keyboard – How to control the keyboard type on mobile
  13. LastSubmit – How to fetch the last submitted record in Power Apps
  14. Media controls in Power Apps – How to improve user experience!
  15. New screens – How to speed up Power Apps dev using templates!

6 thoughts on “OnStart – How to optimize app loading experience!”

Leave a Reply