1

I am trying to refresh the Standard UI of the Record Page on Click of button.

@wire(getRecord, { recordId: '$recordId', layoutTypes: ['Full'], modes: ['View'] })
wiredOpportunity;

@api
refreshOpportunityRecordUI() {        
    return refreshApex(this.wiredOpportunity);
}

I am using refreshOpportunityRecordUI() on click of button, but it doesn't works always on click of that button. It works after few interval time, like 1st time you clicked and now if you click even multiple times, the UI will be not refreshed, but after few seconds around 30-40 it will work.

<lightning-button label="Refresh Contacts2" 
    onclick={refreshOpportunityRecordUI}></lightning-button>

1 Answer 1

3

It depends on the refresh time that you are observing:

Although I didnt find the documentation for wire-service exclusively - how it refreshes the cache - it is similar to this documentation

  1. The callback in the client-side controller is executed with the cached action response .
  2. If the response has been cached for longer than the refresh time, the storage entry is refreshed. When an application enables storable actions, a refresh time is configured. The refresh time is the duration in seconds before an entry is refreshed in storage. The refresh time is automatically configured in Lightning Experience and the Salesforce mobile app .
  3. The action is sent to the server-side controller .
  4. If the response is SUCCESS, the response is added to storage .
  5. If the refreshed response is different from the cached response, the callback in the client-side controller is executed for a second time.

enter image description here

You must log in to answer this question.

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