Choosing Debug Mode and Component Caching to build Lightning Components rapidly and efficiently

As you start developing Lightning Components you must take care of a few settings in Salesforce Org, depending on whether you are in production or development environment.

1. DEBUG MODE: When you quick find/search ‘debug mode‘ in Salesforce org, it shows us a list of users and in front of each user there is a Debug Mode checkbox. Debug mode allows you to pop-up detailed browser error messages and warnings which can really help to debug your code and also force you to follow best practices for developing lightning components.

We should enable debug mode in development sandbox, mainly for users who are developing the lightning components as it makes sure that we follow the best practices but it should be disabled in the production environment as you don’t want your actual users to see these complex error messages and warnings, also all the CSS and javascript that is downloaded to the client is not minified, which means it will take longer to download and longer for your lightning components to load.

2. COMPONENT CACHING: When you quick find/search ‘session settings‘ in Salesforce org, you will see a checkbox named ‘Enable secure and persistent browser caching to improve performance’. By default, this checkbox is true in all environments. This checkbox value should be opposite of what we did in DEBUG MODE. If we enable this checkbox, salesforce will cache some pages to improve performances. In the development environment, we are making frequent changes in code, so it needs to be disabled as we want the latest code every time we refresh and see that component, but in the production environment, we should enable it because the code doesn’t change in production and enabling it will improve performance for the end users.