Delayed Enabling or Disabling of LWS

If your component is using a feature that’s allowed by Lightning Web Security but blocked by Lightning Locker, it can still be blocked after you enable LWS. The reverse can also be true if you disable LWS but see a behavior is allowed but you expected it to be blocked by Lightning Locker. The reason can be that your browser is still using the previous environment due to caching.

To check for evidence that your code is running with LWS, see Determine if LWS is Enabled.

Multiple types of caching can be in effect. For the simplest solution, try refreshing the browser window and clearing the browser cache.

However, sometimes those measures aren’t enough to get the correct behavior, especially if you’re switching LWS on and off frequently while developing and testing.

If the issue persists, try the measures described here.

Supported browsers enable you to disable caching while using the browser developer tools. In the Network panel of the developer tools window, select the Disable Cache checkbox. Then the browser doesn’t load from cache while the developer tools window is open.

Disable the secure and persistent browser caching setting during development in a sandbox or Developer Edition org to see the effect of any code changes without needing to empty the cache.

The caching setting improves page reload performance by avoiding extra round trips to the server.

Disabling secure and persistent browser caching has a significant negative performance impact on Lightning Experience. Always enable the setting in production orgs.

  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.