Refresh View (Beta)
force:refreshView
Reloads the view without a page reload.
For Use In
Lightning Experience, Experience Builder Sites, Salesforce Mobile App
To refresh a view, run $A.get('e.force:refreshView').fire();, which reloads data for standard components. Custom components are refreshed with known limitations, as described below. The force:refreshView event impacts performance and should be avoided, if possible. Repeated firing of this event by a single component or multiple components on a page is not supported. This event is supported in Lightning Experience, the Salesforce mobile app, and Aura-based Experience Builder sites.
This example refreshes the view after an action is successfully completed.
If you fire this event on a Lightning page, such as a record page in Lightning Experience, only standard components are refreshed. This example displays a form using lightning:recordForm, which enables you to create a contact record on an account record page. The custom component then refreshes the data on standard components on the record page, such as the contact related list.
During the submit event, assign the account ID to the contact record. When the contact record saves successfully, fire the force:refreshView event to reload the contact related list on the account page, which is a standard component on the record page.
Refreshing the following views recreates and refreshes the custom components within it.
- Action override for a record action using
lightning:actionOverride - Lightning component that’s directly addressable using
lightning:isUrlAddressable - Lightning tab
This example refreshes the view after a server-side action that changes the data is successfully completed.
force:refreshView does not impact storable Aura Actions as they are stored in the cache. To improve performance, we recommend you use storable Aura actions. For more information, see Storable Actions.
We don’t recommend you to handle this event as it’s handled automatically by the app. To maintain the latest data on your page while reading and modifying your data, we recommend using force
Always consider using Lightning Data Service first to work with Salesforce data. If you’re creating custom components with Lightning Web Components, use the Lightning Data Service wire adapters and functions in the lightning/ui*Api modules to work with record data. For example, use getRecordNotifyChange() to refresh the Lightning Data Service cache after you update a record outside of its mechanisms, such as via imperative Apex or Visualforce. To illustrate, the first example on this page can be rewritten using force:recordData without firing the force:refreshView event. For more information, see Creating a Record.
Markdown content for specifications