Lightning (Salesforce Lightning) is a component-based framework for app development from Salesforce that is aimed at simplifying processes for those business users who do not possess much programming experience. Lightning consists of the collection of tools and technologies behind a significant upgrade to the Salesforce1 Platform, the company's mobile app development platform. Generally, Lightning Components run at the client-side, in a single page and alongside other components that work on the same data. Want to know how these characteristics impact performance and what are the best ways to optimize the performance of Lightning Development components? You’ve reached just the right place. Read on to find out!
Application composition is an extremely efficient way of building apps by assembling self-contained components. However, should you approach these components without proper planning, their autonomous nature can end up having an adverse impact on performance. For instance, if all the components you build make their own isolated calls to the server to retrieve the data they need, you’ll most likely find yourself at the receiving end of numerous redundant server calls. Subsequently, this can dramatically impact performance.
This is where client-side data caching can come to your rescue. By sharing data among components, it can significantly reduce the number of server round-trips, thereby improving the performance of your Lightning components by leaps and bounds. The Lightning Component Framework has two built-in mechanisms for client-side caching (storable actions and Lightning Data Service). On top of that, can also implement a custom caching solution.
Listed below are some data retrieval best practices that you can implement to improve the performance of your Lightning Development components.
Bound and unbound expressions using which one can establish a connection between UI elements and attributes.
Showing every available piece of data and every available tool on the screen just in case the user may need it is generally not considered a good UI practice. Moreover, it can hamper the performance of your application by a significant margin. Hence, today’s interactive design guidelines favour progressive disclosure.
Progressive disclosure is an interaction design technique frequently implemented in human-computer interaction that aims to reduce confusion, clutter, and cognitive workload. As a result, it helps in maintaining the focus of a user’s attention This improves usability by presenting only the minimum data required for the task at hand. In Lightning Experience, it’s easy to implement progressive disclosure and defer the data or features that aren’t essential to the task at hand.
Lightning Data Service provides a managed record approach. The framework is responsible for managing records- fetching them from the server when requested the first time, storing them in a highly efficient client cache, sharing them between all components that request them, and sending changes to the server. Lightning Data Service also handles progressive loading which is to say that it only loads the requested fields. Should another component happen to subsequently require an additional field, this field would be loaded transparently and added to the record in the cache. In contrast to storable actions that can cache any type of response returned by an Apex method, Lightning Data Service only caches discrete Salesforce sObjects.
Before you decide to use a third-party library in a Lightning component evaluate whether that library is really going to contribute to the overall performance. DOM manipulation libraries such as Query and UI libraries viz. Bootstrap or jQuery UI, in particular, may no longer be needed when working with the Lightning Component Framework.
Dreamstel Technologies is a leading global IT solutions & services company, headquartered in NSW, Australia, with development centres in Noida, India and Delaware, USA. Providing trusted IT solutions for the IT industry, Dreamstel has been passionately helping businesses grow to become recognized entities, since the year 2005.
We at Dreamstel, deliver innovative IT solutions and Package Development Model Salesforce consulting to a variety of industries in the areas of finance, manufacturing, e-commerce, technology, telecom, retail, healthcare and others. Our objective is to help you drive enhanced customer engagement with operational efficiency. Digitalization offers an end to end approach to your business, and our hand-picked tech experts ensure your business gets the best services without any interruptions. We devote our knowledge, expertise and energy towards growing your business by going an extra mile with our services.