wordpress.com - saramorgan.net @sarahasnolimits at ......top 5 debugging tips # 1 - check debug mode...
TRANSCRIPT
![Page 1: WordPress.com - saramorgan.net @SaraHasNoLimits at ......Top 5 Debugging Tips # 1 - Check Debug Mode Setting ONLY Enable for Development or Sandboxes Make sure you Disable for Production](https://reader033.vdocuments.site/reader033/viewer/2022060522/60509f81d00b5719224ccdea/html5/thumbnails/1.jpg)
Lightning Performance and Debugging Tips for Developers
Sara Morgan NettlesLead Technical Curriculum Engineer
at Salesforce@SaraHasNoLimits
http://saramorgan.net
![Page 2: WordPress.com - saramorgan.net @SaraHasNoLimits at ......Top 5 Debugging Tips # 1 - Check Debug Mode Setting ONLY Enable for Development or Sandboxes Make sure you Disable for Production](https://reader033.vdocuments.site/reader033/viewer/2022060522/60509f81d00b5719224ccdea/html5/thumbnails/2.jpg)
Round of applause for our Platinum Sponsors!
![Page 3: WordPress.com - saramorgan.net @SaraHasNoLimits at ......Top 5 Debugging Tips # 1 - Check Debug Mode Setting ONLY Enable for Development or Sandboxes Make sure you Disable for Production](https://reader033.vdocuments.site/reader033/viewer/2022060522/60509f81d00b5719224ccdea/html5/thumbnails/3.jpg)
Round of applause for our Gold Sponsors!
![Page 4: WordPress.com - saramorgan.net @SaraHasNoLimits at ......Top 5 Debugging Tips # 1 - Check Debug Mode Setting ONLY Enable for Development or Sandboxes Make sure you Disable for Production](https://reader033.vdocuments.site/reader033/viewer/2022060522/60509f81d00b5719224ccdea/html5/thumbnails/4.jpg)
I Am Also a Pluralsight Author
• Getting Started Building SPAs with Lightning Components
• Customizing Salesforce with Lightning Components
• Lightning Component Development Best Practices
![Page 5: WordPress.com - saramorgan.net @SaraHasNoLimits at ......Top 5 Debugging Tips # 1 - Check Debug Mode Setting ONLY Enable for Development or Sandboxes Make sure you Disable for Production](https://reader033.vdocuments.site/reader033/viewer/2022060522/60509f81d00b5719224ccdea/html5/thumbnails/5.jpg)
Agenda
• Top 5 Performance Tips
• Top 5 Debugging Tips
• Demo of Using Lightning Inspector
• Questions
![Page 6: WordPress.com - saramorgan.net @SaraHasNoLimits at ......Top 5 Debugging Tips # 1 - Check Debug Mode Setting ONLY Enable for Development or Sandboxes Make sure you Disable for Production](https://reader033.vdocuments.site/reader033/viewer/2022060522/60509f81d00b5719224ccdea/html5/thumbnails/6.jpg)
Top 5 Performance Tips
![Page 7: WordPress.com - saramorgan.net @SaraHasNoLimits at ......Top 5 Debugging Tips # 1 - Check Debug Mode Setting ONLY Enable for Development or Sandboxes Make sure you Disable for Production](https://reader033.vdocuments.site/reader033/viewer/2022060522/60509f81d00b5719224ccdea/html5/thumbnails/7.jpg)
# 1 - Check Component Caching Setting
To Enable/Disable Component Caching:1. From Setup, go to Session Settings.2. Select/Deselect the Enable secure and
persistent browser caching to improve performance checkbox.
3. Click Save.
May Want to Disable for Development
Definitely Enable for Production
![Page 8: WordPress.com - saramorgan.net @SaraHasNoLimits at ......Top 5 Debugging Tips # 1 - Check Debug Mode Setting ONLY Enable for Development or Sandboxes Make sure you Disable for Production](https://reader033.vdocuments.site/reader033/viewer/2022060522/60509f81d00b5719224ccdea/html5/thumbnails/8.jpg)
# 1 - Check Component Caching Setting
For SalesforceDX developers, you can disable the setting automatically for scratch orgs with the following line in your config file
![Page 9: WordPress.com - saramorgan.net @SaraHasNoLimits at ......Top 5 Debugging Tips # 1 - Check Debug Mode Setting ONLY Enable for Development or Sandboxes Make sure you Disable for Production](https://reader033.vdocuments.site/reader033/viewer/2022060522/60509f81d00b5719224ccdea/html5/thumbnails/9.jpg)
# 2 - <aura:if> for Conditional Rendering
Don’t Use this
<div aura:id=“submitBtn” class=“slds-hide”>
<lightning:button label="Submit"
onclick="{!c.newRecord}" />
</div>
cmp.find(“submitBtn").toggleClass(!isVisible, "slds-hide");
![Page 10: WordPress.com - saramorgan.net @SaraHasNoLimits at ......Top 5 Debugging Tips # 1 - Check Debug Mode Setting ONLY Enable for Development or Sandboxes Make sure you Disable for Production](https://reader033.vdocuments.site/reader033/viewer/2022060522/60509f81d00b5719224ccdea/html5/thumbnails/10.jpg)
# 2 - <aura:if> for Conditional Rendering
Use this instead
<aura:if isTrue="{!v.isVisible}">
<lightning:button label="Submit"
onclick="{!c.newRecord}" />
</aura:if>
https://bit.ly/2Lf3YRp for more info
![Page 11: WordPress.com - saramorgan.net @SaraHasNoLimits at ......Top 5 Debugging Tips # 1 - Check Debug Mode Setting ONLY Enable for Development or Sandboxes Make sure you Disable for Production](https://reader033.vdocuments.site/reader033/viewer/2022060522/60509f81d00b5719224ccdea/html5/thumbnails/11.jpg)
# 3 - Limit Data Returned
• Make sure SELECT statement only returns data you
absolutely need
• Use the LIMIT clause to limit # of rows returned
• Consider adding pagination to lists of data
• https://bit.ly/2J89QiP for more info
![Page 12: WordPress.com - saramorgan.net @SaraHasNoLimits at ......Top 5 Debugging Tips # 1 - Check Debug Mode Setting ONLY Enable for Development or Sandboxes Make sure you Disable for Production](https://reader033.vdocuments.site/reader033/viewer/2022060522/60509f81d00b5719224ccdea/html5/thumbnails/12.jpg)
# 4 - Use the Lightning Data ServiceAKA: The Standard Controller for Lightning
Benefits include:
No APEX or SOQL needed
FLS and CRUD security built-in
Auto-notify on record changes
Offline access for Salesforce Mobile
Single Request and Cached Response
![Page 13: WordPress.com - saramorgan.net @SaraHasNoLimits at ......Top 5 Debugging Tips # 1 - Check Debug Mode Setting ONLY Enable for Development or Sandboxes Make sure you Disable for Production](https://reader033.vdocuments.site/reader033/viewer/2022060522/60509f81d00b5719224ccdea/html5/thumbnails/13.jpg)
# 4 - Use the Lightning Data Service
Lightning Component
Lightning Component
Lightning Data
ServiceController
Shared Data
Cache
Salesforce
<force:recordData>
Lightning Component
<force:recordData>
<force:recordData>
![Page 14: WordPress.com - saramorgan.net @SaraHasNoLimits at ......Top 5 Debugging Tips # 1 - Check Debug Mode Setting ONLY Enable for Development or Sandboxes Make sure you Disable for Production](https://reader033.vdocuments.site/reader033/viewer/2022060522/60509f81d00b5719224ccdea/html5/thumbnails/14.jpg)
# 4 - Use the Lightning Data Service<force:recordData aura:id="raceRecordCreator"
layoutType="FULL"
targetRecord="{!v.newRaceRec}"
targetFields="{!v.newRace}"
targetError="{!v.errorMsg}" />
https://bit.ly/2xGxKfS for more info
![Page 15: WordPress.com - saramorgan.net @SaraHasNoLimits at ......Top 5 Debugging Tips # 1 - Check Debug Mode Setting ONLY Enable for Development or Sandboxes Make sure you Disable for Production](https://reader033.vdocuments.site/reader033/viewer/2022060522/60509f81d00b5719224ccdea/html5/thumbnails/15.jpg)
# 5 - Use Storable Actions When Possible
Notice the Pagination
![Page 16: WordPress.com - saramorgan.net @SaraHasNoLimits at ......Top 5 Debugging Tips # 1 - Check Debug Mode Setting ONLY Enable for Development or Sandboxes Make sure you Disable for Production](https://reader033.vdocuments.site/reader033/viewer/2022060522/60509f81d00b5719224ccdea/html5/thumbnails/16.jpg)
# 5 - Use Storable Actions When Possible
var action = component.get('c.getRacesDB');
action.setStorable();
action.setCallback(this, function(response) {
// Code here to handle the response
}
$A.enqueueAction(action);
Caching in a Single Line of Code
https://bit.ly/2wdRHFR for more info
![Page 17: WordPress.com - saramorgan.net @SaraHasNoLimits at ......Top 5 Debugging Tips # 1 - Check Debug Mode Setting ONLY Enable for Development or Sandboxes Make sure you Disable for Production](https://reader033.vdocuments.site/reader033/viewer/2022060522/60509f81d00b5719224ccdea/html5/thumbnails/17.jpg)
Top 5 Debugging Tips
![Page 18: WordPress.com - saramorgan.net @SaraHasNoLimits at ......Top 5 Debugging Tips # 1 - Check Debug Mode Setting ONLY Enable for Development or Sandboxes Make sure you Disable for Production](https://reader033.vdocuments.site/reader033/viewer/2022060522/60509f81d00b5719224ccdea/html5/thumbnails/18.jpg)
# 1 - Check Debug Mode SettingONLY Enable for Development or Sandboxes
Make sure you Disable for Production
To Enable/Disable Debug Mode:1. From Setup, go to Lightning Components.2. Select/Deselect the Enable Debug Mode
checkbox.3. Click Save.
![Page 19: WordPress.com - saramorgan.net @SaraHasNoLimits at ......Top 5 Debugging Tips # 1 - Check Debug Mode Setting ONLY Enable for Development or Sandboxes Make sure you Disable for Production](https://reader033.vdocuments.site/reader033/viewer/2022060522/60509f81d00b5719224ccdea/html5/thumbnails/19.jpg)
# 2 - Use the Salesforce CLI Linting Tool
Salesforce DX includes a linting tool you can use during development to avoid Locker Service conflicts and anti-patterns
https://sforce.co/2LW7mSd for more about the Salesforce CLI
![Page 20: WordPress.com - saramorgan.net @SaraHasNoLimits at ......Top 5 Debugging Tips # 1 - Check Debug Mode Setting ONLY Enable for Development or Sandboxes Make sure you Disable for Production](https://reader033.vdocuments.site/reader033/viewer/2022060522/60509f81d00b5719224ccdea/html5/thumbnails/20.jpg)
# 2 - Use the Lightning Linter Service?
https://lightning-linter.herokuapp.com/
![Page 22: WordPress.com - saramorgan.net @SaraHasNoLimits at ......Top 5 Debugging Tips # 1 - Check Debug Mode Setting ONLY Enable for Development or Sandboxes Make sure you Disable for Production](https://reader033.vdocuments.site/reader033/viewer/2022060522/60509f81d00b5719224ccdea/html5/thumbnails/22.jpg)
# 4 - Use Lightning Testing Service
https://sforce.co/2kUXegv for more info
Set of tools used to create test suites in Jasmine or Mocha
Currently in Pilot
![Page 23: WordPress.com - saramorgan.net @SaraHasNoLimits at ......Top 5 Debugging Tips # 1 - Check Debug Mode Setting ONLY Enable for Development or Sandboxes Make sure you Disable for Production](https://reader033.vdocuments.site/reader033/viewer/2022060522/60509f81d00b5719224ccdea/html5/thumbnails/23.jpg)
# 4 - Use Lightning Testing Service
https://bit.ly/2xQEIPs for tips on my blog
![Page 24: WordPress.com - saramorgan.net @SaraHasNoLimits at ......Top 5 Debugging Tips # 1 - Check Debug Mode Setting ONLY Enable for Development or Sandboxes Make sure you Disable for Production](https://reader033.vdocuments.site/reader033/viewer/2022060522/60509f81d00b5719224ccdea/html5/thumbnails/24.jpg)
# 5 - Use the Lightning Inspector Plugin
![Page 25: WordPress.com - saramorgan.net @SaraHasNoLimits at ......Top 5 Debugging Tips # 1 - Check Debug Mode Setting ONLY Enable for Development or Sandboxes Make sure you Disable for Production](https://reader033.vdocuments.site/reader033/viewer/2022060522/60509f81d00b5719224ccdea/html5/thumbnails/25.jpg)
# 5 - Use the Lightning Inspector Plugin
https://sforce.co/2jNXJr2 for more info
![Page 26: WordPress.com - saramorgan.net @SaraHasNoLimits at ......Top 5 Debugging Tips # 1 - Check Debug Mode Setting ONLY Enable for Development or Sandboxes Make sure you Disable for Production](https://reader033.vdocuments.site/reader033/viewer/2022060522/60509f81d00b5719224ccdea/html5/thumbnails/26.jpg)
Demo Time
![Page 27: WordPress.com - saramorgan.net @SaraHasNoLimits at ......Top 5 Debugging Tips # 1 - Check Debug Mode Setting ONLY Enable for Development or Sandboxes Make sure you Disable for Production](https://reader033.vdocuments.site/reader033/viewer/2022060522/60509f81d00b5719224ccdea/html5/thumbnails/27.jpg)
Check Out These Amazing Trails:
-Lightning Component Tips and Gotchas-Lightning Data Service Basics-Lightning Component Basics
![Page 29: WordPress.com - saramorgan.net @SaraHasNoLimits at ......Top 5 Debugging Tips # 1 - Check Debug Mode Setting ONLY Enable for Development or Sandboxes Make sure you Disable for Production](https://reader033.vdocuments.site/reader033/viewer/2022060522/60509f81d00b5719224ccdea/html5/thumbnails/29.jpg)
Happy trails ‘til next year, y’all!