In many cases I’ve seen that LE is not displaying recent changes made in Setup immediately like in Salesforce Classic, but somehow cached or delayed. Yesterday I found an easy and perfectly reproducible scenario and I want to ask why this is happening and how to enforce a real and total refresh flushing every possible cache.
Example Scenario (please do NOT provide workarounds for this – emphasis is on EXAMPLE ONLY)
I was showing a client how Field Level Security (FLS) works. My example was to hide a field going to: Setup(Classic) > Customize > Accounts > Fields and scroll there down and pick any existing custom field (as an example). Now on the field-view press the button [Set Field-Level-Security] and remove all checkboxes in the “Visible”-column. Press Save. Verify the result on any Account record view.
Expected result in Aloha (Salesforce Classic):
On Aloha the impact is immediately: removing checkboxes hides the field after doing a page-refresh (F5). Checking all the boxes again make the field show-up after the next F5 fully as expected. Fine!
Delayed impact in Lightning Experience:
But not so in LE! First F5 is a huge roundtrip and you can say “Hi” to the snowman again. Back on the record page the field is still displayed. Cross-Check in Aloha: the field is already invisible as expected. Now waiting for a time eventually seems to make it disappear – but I was not able to do it fast and not predictable. Sometimes it took seconds, sometimes minutes. This is a no-go for fancy Admin-Tasks: please figure more complex examples, where you have to (quickly!) verify settings e.g. for several different profiles.
- why this is happening? I’m sure this is a kind of cache and designed as a feature (and is no bug). I want to understand the technical backgrounds (deeply).
- how can I enforce to flush all caches and make 100% sure, that all obsolete data is reloaded freshly from the server?
- is there an option to disable that cache either for the Org completely, or for profiles, or for certain users?
What I’ve tried so far:
- clear browser cache ==> no impact, still obsolete stuff will be shown
- clear local storage ==> no impact, still obsolete stuff will be shown
- clear session storage ==> no impact, still obsolete stuff will be shown
Now I’m running out of ideas. The response seems to be cached sever-side, where my local flushes can’t reach. The result is re-sending “dirty” data on-and-on until something “unknown” happens and the response is eventually updated. Personally I don’t like that feature at all, but I’m sure for many users there are good reasons to turn it OFF selectively from time to time.
Actually, this problem is due to the “aggressive” caching setting in LEX. Go to Setup Home > Security > Session Settings. Uncheck the option: Enable secure and persistent browser caching to improve performance. That should make it such that only a single page reload gives you new data/settings/etc.