I have a custom Lightning Web Component that allows modification of multiple records inside of modal. Once a record is updated, I reload that same record-id, but the old data shows up instead of the new data. After thorough research, I have concluded that the Lightning Data Service is at fault here. It is caching the data in the built-in ViewState most likely. The only way to get a data refresh is by refreshing the entire web page. I found multiple articles that explain how to turn off Secure and Persistent Browser Caching, but this is an unacceptable solution, as the entire Organization will take a performance hit, to support my little Lightning Web Component. Also salesforce insists that you don't do it production:



How do I invalidate or send a ChangeNotify Event to the Lightning Data Service (in the context of Lightning Web Components), so my lightning-record-edit-form shows the updated data, instead of the old data (without refreshing the entire web page of course)?

Specific Screenshot

enter image description here In the screenshot above (sorry for the low res.), the 'Modify Existing Entry' section is loaded with the respective row details from the DataTable below when the user clicks the 'Modify' action seen below. The 'Modify Existing Entry' section visibility and record-id depend on the HTML attributes as follows:

<lightning-record-edit-form object-api-name="Case_Detail__c"
 if:true={ModifyRMADetailFormVisible} ... >

The problem is when the user clicks the 'Modify' action the second time for a given row (image above shows this scenario). Instead of loading the updated values for Serial Number, Manufacturer and Model, it loads the previous values (caching problem). As mentioned above, when I turn off the 'Enable secure and persistent browser caching to improve performance' feature in Session Settings, the caching problem goes away. However, this is not an acceptable resolution for the organization (per management - already asked). What I essentially want to do is disable 'Enable secure and persistent browser caching to improve performance' selectively in the context of my Lightning Web Component.

  • It is not clear how exactly its loading from cache. for example, you can use either temple if:true (conditional rendering) or just slds-hide just to hide the modal. Also there are many other factors, you can either post the code or show gif in question so that we understand what is happening. As of now question is too broad Sep 14, 2019 at 2:33
  • @salesforce-sas Thanks for your response. I have updated the question with a screenshot and outlined the specifics of my issue. Thanks again for taking the time to assist me.
    – Mr. B
    Sep 16, 2019 at 15:13
  • have you tried firing refreshview event post your operations?developer.salesforce.com/docs/component-library/bundle/…
    – Rao
    Sep 16, 2019 at 17:07
  • @Rao I've seen the approach you are talking about but cannot find a this.dispatchEvent LWC (Lightning Web Component) equivalent. Is there a way to do this in LWC. If so can you answer the question with how to incorporate it into an LWC?
    – Mr. B
    Sep 16, 2019 at 18:38
  • Oops I did not see lwc was assuming lightning
    – Rao
    Sep 16, 2019 at 22:15

1 Answer 1


Not invalidating the cache ended up being a known bug per salesforce support request. I had to fall back to Apex. My code looks like:

import LookupIt from 
import DeleteIt from 
import StoreIt from 

Then for example for my onsubmit button I have:

// Prevent submit

// Invoke store Apex
StoreIt({identity: this.LookupItResult.Id, storageModel: evt.details.fields})
  .then(result => { ... }
  .catch(error => { console.log(error) });

You must log in to answer this question.

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