Top 15 Salesforce Lightning Components to Improve Functionality

  3308

Lightning Components is a UI system for creating web applications for portable and work area gadgets. It’s a cutting-edge system for building single-page applications with dynamic, responsive UI for Lightning Platform applications. It utilizes JavaScript on the customer side and Apex on the server side.

Salesforce Lightning Components

Every now and then you need to deploy tricks that will improve the performance of your

1). Avoid Server Trips

Most evident plan to enhance Lightning Component Performance is to keep away from server trips. Suppose, you have to know the queue Id to be allocated as proprietor in Case and furthermore require custom setting data to determine the conduct of Lightning Component. There are two different ways to accomplish this – Call Apex Controller multiple times versus return consolidated outcomes from Apex in a single call and process JSON in customer side controller of Lightning Component.

2). Use Storable Action

In this methodology, Lightning component demonstrates the stored result as opposed to making prompt server trip. Lightning part will make the server (Apex) bring in the foundation and whenever the reserved outcome is stale, at that point it would store and revive the lightning segment. This is exceptionally helpful for gadgets which have got slow internet connections. On the off chance that you are Facebook or Google News client, you would be able to effectively relate to it. When we open these applications, it indicates past feed and if there are new feeds, it gives us choice to invigorate see or consequently revive it. You should simply, on customer side controller of the Lightning component, stamp activity as storable utilizing this code action.setStorable().

3). Use Lightning Data Service

Lightning Data Service is the process that is proportionate to Standard Controllers for Lightning Component. You don’t have to compose Apex Test classes for your Lightning Component. In any case, Lightning Data Service needs more recognization rather than trying to say we don’t have to compose Apex. Another critical side of Data Service is its capacity to utilize shared cache.

4). Custom Cache

On the off chance that Lightning Data Service and Storable Action can’t full fill necessity then you can likewise construct your own custom reserve. Favorable position of the custom store is that you would have full command over life cycle and conduct of cache.

Related Post:  Cardinals of Transition to Salesforce Lightning

5). Lazy Instantiation of Component

Rather than making all Lightning Components at the same time, you can postpone instantiation of the Lightning segment. This is a process that you need to deploy and de-deploy from time to time.

6). Conditional rendering

There are two different ways to restrictively render Lightning Components

  • Using CSS- On the off chance that we use CSS, the segment would, in any case, be made and on the off chance that there is an event related with it, it would be executed. Therefore, this way to deal with a restrictively render segment or component isn’t prescribed.
  • Using aura: if- On the other hand, would make component only if the condition is valid. Along these lines, we should utilize aura: if as much conceivable to concede page load.

7). Use of Unbound Expression

There are two different ways to tie factors in Lightning Components

  • Bi-directional binding: It is indicated utilizing! Image like {!v.var1}. For this situation, if the value in var1 changes, the Lightning part would be notified and the value would be refreshed.
  • Unidirectional or unbound expression: If you don’t really need to upgrade Lightning components on the off chance that value isn’t transforming, you can enhance execution utilizing # rather than!. Syntax would look like {#v.var1}

 8). Use aura: Method for Component Communications

Rather than utilizing events, we can utilize aura: method to encourage correspondence between components. Its like uncovering exposing API. There are few preferences of utilizing aura: method rather than events, similar to the capacity to name technique which would clear up and distinguish conduct, capacity to utilize the same contentions and characterize different strategies.

9). Limit event handlers

Attempt to restrain a number of event handlers in your Lightning component. As you can figure, numerous occasion handler implies your part would be occupied in listening to event changes bringing about performance overload.

10). Limit use of Application event

As we probably are already aware, there are two sorts of events – Application and Component events. Application events are ground-breaking and give heaps of adaptability to convey between any components in Application. In any case, we should utilize the Application event with incredible safety measure. As Application event is communicated to all components at the same time, it may be excessive for a few parts, if it’s not required.

Related Post:  How to Merge Accounts In Salesforce?

11). Limit use of JavaScript Libraries

This is the best time to return to basics and learn JavaScript. There was a time when just a couple of libraries were there like JQuery, underscoreJs and so on. However, in this consistently changing innovation consistently there is a new Library and new forms of existing libraries. In the meantime, vanilla JavaScript has additionally turned out to be all the more amazing with dynamic arrivals of EcmaScript. You may have the capacity to accomplish a large portion of stuff by joining Vanilla JavaScript and Aura structure. $A.util has numerous valuable techniques for Lightning Component improvement.

12).  Use the Minified version of JavaScript Libraries

This is a very easy practice. On the off chance that you wind up utilizing the library, ensure that it is minified, with the goal that HTTP load would be negligible.

13). Use of Lightning Base Components

Rather than reinventing wheels or outsider Lightning Components, examine the base components first. Making custom segment and after that applying Salesforce Lightning Design System doesn’t bode well in the event that you as of now have a Base component. Base component fuses Lightning Design System, enhanced execution with insignificant impressions and best practices.

14). Debug mode off in Production

You can disable Lightning Component debug mode by exploring to –

Setup >> Custom Code >> Lightning Components and done.

15). Performance Profiling

There are numerous devices accessible to dive into the issue of the moderate Lightning component before playing in the darkness. Devices like Lightning Component Inspector in Google chrome or chrome performance tool can be of aid here.

Conclusion

It is advisable that you choose 4-5 tips from the list given above and deploy them. After a certain period of time you can deploy the next lot of 4-5 techniques. Do not bombard your instance with all of these techniques altogether, it will lead to a disaster you do not want to imagine.

Write a Comment

avatar
  Subscribe  
Notify of

Download & Learn from Our Whitepapers

Stop, read and acquire deep insights into complex issues