4

I am developing a LWC, using Visual Studio, so I am frequently deploying JS, HTML and CSS file to the org. As a browser I use Chrome (latest version) under Windows 10.

What I am seeing: not updated or even previous versions of JS/HTML/CSS being active instead of the most recent sources. As a standard procedure I press Ctrl-F5 everytime the deploy is completed, but that is not always enough. Sometimes I have to restart the browser and even then it does not always work.

What is a sure-fire way of making the browser use the latest sources?

1 Answer 1

6

You should Disable Caching. This has obvious performance penalties, but should show the latest version of your code.

  1. From Setup, enter Session in the Quick Find box, and then select Session Settings.

  2. Deselect the checkbox for “Enable secure and persistent browser caching to improve performance”.

  3. Click Save.

5
  • Hmm... in my version of Chrome (80.0.3987.132) searching for Session in the settings does not give any results. Search on cache/caching only enables manual deletion of the cache. Are you using Chrome under Windows or a different OS? Commented Mar 9, 2020 at 13:27
  • @SanderdeJong It's a Salesforce setting, not a browser setting. I apologize if that was unclear.
    – sfdcfox
    Commented Mar 9, 2020 at 14:29
  • Ah... that explains it. Humans... so capable of creating misunderstandings. Thanks! Commented Mar 9, 2020 at 14:47
  • 3
    Another tip for development, Under Setup --> Develop --> Lightning Components --> Debug Mode, enable debug mode for your user to get un-minified versions of your JS code.
    – Ben Nguyen
    Commented Mar 9, 2020 at 17:15
  • Sorry, I had to uncheck this as being an answer. I just noticed the same behaviour again. Caching in SF is off, I press Ctrl-F5 all the time in the browser and I just noticed a version of my JS code active that is at least a few hours old. And not the most recent version. Maybe it's a Chrome bug? Commented Mar 10, 2020 at 10:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .