Deep Dive into App.StartScreen and App.OnStart: Leveraging Powerful Navigation and Initialization in Canvas Apps

Canvas apps provide a versatile and low-code approach to app development, enabling users to build custom applications quickly and easily. They are suitable for a wide range of scenarios, such as data collection forms, process automation, data visualization, and more. Microsoft continues to update and enhance the capabilities of canvas apps, and new features and improvements are released on a regular basis.

Canvas apps primarily use a declarative approach, which allows us to design the app's user interface and behavior using properties, formulas, and expressions. However, we can also take advantage of imperative-like functions and operators for more fine-grained control and inclusion of complex logic when needed.

At the top of the tree pane in canvas apps, there is an object that provides information about the currently running app and controls over the app's behavior. "App" refers to an entire application that we build using the Power Apps canvas app platform. It represents the collection of screens, controls, data sources, and logic that make up the user interface and functionality of the app.


App.OnStart:

This OnStart property has important uses in app development as it is often used to perform initialization work, retrieve data and set the initial state of the app, and determine which screen will be displayed first. In other words, `App.OnStart` is used for one-time initialization and global app-level settings, however, if not optimized properly, the App.OnStart formula can potentially cause performance issues .


Over time, it was observed that some factors that can contribute to performance issues in App.OnStart include dependencies on external resources or if App.OnStart contains synchronous actions that require waiting for a response. In addition, Calculations or operations that involve large amounts of data or multiple iterations can significantly impact app performance, as a result, it takes a long time before the screen is displayed. 

App.StartScreen:

Microsoft has introduced a new property StartScreen of the App object which loads faster and gives better user experience and also they will be easier to write and debug. By default, the first screen shown when the app starts is in the tree view in Power App Studio, but App.StartScreen is a new declarative way of indicating which screen should be shown first that doesn't block optimizations.


  • App.StartScreen is optional property.
  • App.StartScreen is a data flow property that can't contain behavior functions.
  • App.StartScreen is the new declarative way to indicate which screen should be shown first.

Conclusion :

This would make App.StartScreen be considered a subset of App.OnStart or a newer version of App.OnStart , but that doesn't mean that the OnStart property of the App object will go away. It's a way to write less code to display the first screen faster, simplify the lifecycle of the app, and avoid common pitfalls. While App.StartScreen is the declarative method for setting the first screen in canvas apps, App.OnStart is the imperative method to improve performance and keep an ordered list of tasks to be performed before the screen is displayed. and optimization of Power Apps.

Comments

Popular posts from this blog

Powering Up Your Analytics: Exploring Power Query in Power BI

Power App Component Overview : Canvas App vs Model-Driven App

Exam PL-400: Microsoft Power Platform Developer