Salesforce

When Does a Component Load (Magic xpa 4.x)

« Go Back

Information

 
Created BySalesforce Service User
Approval Process StatusPublished
Objective
Description

When Does a Component Load (Magic xpa 4.x)

In the Repository properties, you can determine when the component will be loaded during runtime. The component can either be loaded together with the host application, as specified in the Immediate setting, or when the first call is made to a task that uses it, as specified in the On Demand setting. When to load the component depends on the nature of your application and how it is constructed.

When a component loads, its main program loads as well. If operations are performed in the main program, such as variable initialization or memory table initialization, these operations will always be executed. Because the main program is only executed once, whether the component load property is Immediate or On Demand makes a big difference.

  • If a component has the load property Immediate and a host project program calls a component project program, the component’s main program will not be called again.

  • If a component has the On Demand property and a host project program calls a component application program, the component’s main program is called because the component is loaded and initialized at the same time. Nevertheless, during subsequent calls to any component program, the component main program will not be called.

It is important to give some thought as to when a component should be loaded. If you have many components and all of them are loaded upon application startup, the initial load may take a long time. All component resources will be immediately available when the application loads, but a lot of memory will be consumed. If some of those components are rarely accessed or accessed only by certain users, loading them initially may be counter-productive. However, If your components contain models, data sources, events, programs, and other items that are used widely and frequently, it makes sense to load them initially.

Reference
Attachment 
Attachment