To improve the performance of the lightning component cache Salesforce introduced storable (cacheable) in Winter’19 release. In API version 44.0 and later, you can mark an Apex method as storable (cacheable) instead of using setStorable() on every JavaScript action that calls the Apex method to centralize your caching notation for a method in the Apex class.
Here is an example to cache data returned from an Apex method for lightning component, annotate the Apex method with @AuraEnabled(cacheable=true).
Apex Class:
public class SampleAuraController {
@AuraEnabled(cacheable = true)
public static List<Account> getDirectCustomerAccount() {
List<Account> accList = new List<Account>();
accList = [SELECT Id, Name, Type, Industry, Phone
FROM Account WHERE Type = 'Customer - Direct'];
return accList;
}
}
Using lightning:workspaceAPI we can change Tab Label dynamically. Basically this component allows to access methods for programmatically controlling workspace tabs and subtabs in a Lightning console app. Here is an example to change Account record Tab Label “Account Name” to “Account Type” with “Account Name”.
Account Standard Tab Label:
Lightning Component:
<aura:component implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global">
<!--Attributes-->
<aura:attribute name="accFields" type="Account"/>
<!--Component Start-->
<!--Lightning Workspace API-->
<lightning:workspaceAPI aura:id="workspace"/>
<!--Lightning Force Data to get Account record-->
<force:recordData aura:id="accRecordData"
layoutType="FULL"
recordId="{!v.recordId}"
targetFields="{!v.accFields}"
recordUpdated="{!c.handleRecordUpdate}"/>
<!--Component End-->
</aura:component>