4

During development of Lightning Web Components I have seen on multiple occasions an issue where the compiled source in the browser does not match the source deployed to the org, but instead matches an earlier version from that day's development.

The scenario is usually as follows.

On a scratch org that has not expired with debug mode enabled and persistent caching disabled:

  1. Deploy change A. Refresh browser, change A is shown.
  2. Deploy change B. Refresh browser, change B is shown.
  3. Deploy change C. Refresh browser, change C is shown.
  4. Deploy change X. Refresh browser, Browser shows source from change A.
  5. Deploy change X+1. Refresh browser, Browser shows source from change A.
  6. Deploy change X+2. Refresh browser, Browser shows source from change B (or possibly C).

Using another web browser does not fix the issue. The same (incorrect) version of the source is seen in both.

This is not something I ever experienced with Aura and it completely blocks development.

Is there something I can do to force a refresh or prevent this behaviour?

1 Answer 1

1

You have to disable browser caching.

  1. From Setup, locate the link to ‘Session Settings’
  2. Locate the ‘Caching’ section
  3. Uncheck the option to ‘Enable secure and persistent browser caching to improve performance’

Or you can try doing hard refresh by pressing CTRL + F5 on windows/linux and CMD + f5 on mac,

Src: https://www.desynit.com/dev-zone/salesforce-development/disable-browser-caching-for-lightning-components/

5
  • Thanks Pranay, I already have that disabled and am still experiencing the issue. Mar 8, 2019 at 12:20
  • have you enabled Enable Content Delivery Network (CDN) for Lightning Component framework ? Mar 8, 2019 at 12:22
  • Yes, it is enabled by default. Mar 8, 2019 at 12:35
  • Can you disable and try? I have CDN being slow and serving old version Mar 8, 2019 at 12:36
  • It seems that 'Enable secure and persistent browser caching to improve performance' option is bugged. Quite often changes on layouts (for example adding helptexts) are not reflected until you active and deactivate this setting again. Aug 29, 2023 at 11:58

You must log in to answer this question.

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