Advanced Lightning Components

Salesforce Developers · 28K views · 2017 · 44:50

Open on YouTube

Web developmentSoftware performance & optimizationSoftware architecture & designtalkdated

Why Salesforce Stack Exchange recommends it

Salesforce Stack Exchange users link it when explaining Lightning caching behavior, storable actions, and how to wire third-party libraries like CometD into Aura components.

Recommended by 2 people across 2 different months, 2017 to 2022.

What it is

A 45-minute Salesforce Developers session from 2017 aimed at people who already know basic Lightning Components. It covers reusing code between components, using third-party libraries, caching data efficiently with storable actions, and building for performance.

What people said

Recommends Michal Vavra · 2018-09 · Salesforce Stack Exchange · on “Cannot read property of null - ERROR lightning component”

Lightning Data Services are being run asynchronously. When compiler executes helper.showInfoMessage(component); your component still has no response from previously called component.find("accountRecordData").reloadRecord(); . The data won't be there yet. Try to add recordUpdated attribute on "account record" and from there call helper.showInfoMessage(component); . Like @David Reed mentioned, due to the cache the accountRecordData will have data when you reload the page. If you are more interested how Lightning Cache works I would recommend the great talk of Christophe Coenraets on YouTube [this video] (He is talking about Lightning Data Service Cache first 20 minutes).

Recommends Pavan tej · 2022-08 · Salesforce Stack Exchange · on “Cannot read properties of null error while loading an aura component”

Lightning Data Services are being run asynchronously. I belive when compiler executes component.get("v.simpleRecord").fieldname__c; your component still has no response while onloading. Data won't be there yet. Try to add recordUpdated attribute and from there call component.get("v.simpleRecord").fieldname__c; [LINK] If you want to learn more about lightning cache and how it works. check out this Dreamforce [this video]

Cites Raja Vivekanandhan · 2017-07 · Salesforce Stack Exchange · on “aura storable actions not working as expected - client cache”

I am trying to use storable actions. I am not getting expected results. As per the video from salesforce , [this video] , if a method is marked as storable, the first request after refreshAge period is supposed to get the data from cache , followed up by sending a server request, and if the server response is different from what is there in the cache, it is supposed to update the component and cache. I set defaultAutoRefreshInterval as 3 seconds and defaultExpiration as 900 seconds. During my action, I was expecting a server call when I did a UI action after 5 seconds. But the server debug logs, did not receive request from client. But when I repeat the action second time , the request goes to th

Cites Vladyslav K · 2017-08 · Salesforce Stack Exchange · on “Lightning components, CometD - Refused to connect to ... because it violates the following Content Security Policy directive”

I am trying to build a Lightning component by an example from Salesforce Developers Youtube channel, here is original video: [this video] So author encaplulated code for subscribing for Platrorm events in custom component. Usage: <c:Subscriber eventName="MyEvent__e" onmessage="{!c.onMessage}" /> Component: <aura:component description="Subscriber" controller="SessionController"> <aura:attribute name="eventName" type="String" /> <ltng:require scripts="{!$Resource.cometd + '/cometd-javascript-master/cometd.js'}" afterScriptsLoaded="{!c.onJSLoaded}" /> <aura:registerEvent name="onmessage" type="c:MessageEvent" /> </aura:component> Controller: ({ onJSLoaded: function(component, event, helper) { debugg