---
schema_version: "1"
id: 9ab2945d6b2409cc3d50e3d3f9e03e148330fc82e9d976ba889c25b6445e5e4d
title: Refresh View (Beta)
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/lightning-base-components/lightning-design-system/guides/aura/components/force/refreshView/force-refresh-view.md
canonical_url: https://developer.salesforce.com/docs/platform/lightning-component-reference/guide/force-refresh-view.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 5ec8263e652f62bf50e317755a5d1d55e4b0b1f11c865a197fa2422587d10200
products:
  - Lightning Component Reference
---
# Refresh View (Beta)

**`force:refreshView`**

Reloads the view without a page reload.

**For Use In**

Lightning Experience, Experience Builder Sites, Salesforce Mobile App

::::::tabset{tabs='[ "Develop", "Specifications"]'}

:::::tab

**note:** `force:refreshView` is a pilot or beta service that is subject to the Beta Services Terms at [Agreements - Salesforce.com](https://www.salesforce.com/company/legal/agreements/) or a written Unified Pilot Agreement if executed by Customer, and applicable terms in the [Product Terms Directory](https://ptd.salesforce.com/). Use of this pilot or beta service is at the Customer's sole discretion.

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.

```xml
<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global">
  <aura:attribute name="fields" type="String[]" default="['FirstName','LastName']" />

  <lightning:card title="Create Contact">
    <div class="slds-m-horizontal_small">
      <lightning:recordForm
        aura:id="myForm"
        objectApiName="Contact"
        fields="{!v.fields}"
        onsubmit="{!c.createContact}"
        onsuccess="{!c.handleSuccess}"
      />
    </div>
  </lightning:card>
</aura:component>
```

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.

```javascript
({
  createContact: function (component, event, helper) {
    event.preventDefault();
    var fields = event.getParam("fields");
    fields.AccountId = component.get("v.recordId");
    component.find("myForm").submit(fields);
  },

  handleSuccess: function (component, event, helper) {
    $A.get("e.force:refreshView").fire();
  },
});
```

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.

```javascript
({
  refresh: function (component, event, helper) {
    var action = component.get("c.myController");
    action.setCallback(component, function (response) {
      var state = response.getState();
      if (state === "SUCCESS") {
        // Refresh the view
        // after data is updated
        $A.get("e.force:refreshView").fire();
      } else {
        // Handle the 'ERROR' or 'INCOMPLETE' state
      }
    });
    $A.enqueueAction(action);
  },
});
```

## Usage Considerations

`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](https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/controllers_server_storable_actions.htm).

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:recordData, which is built on [Lightning Data Service](https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/data_service.htm).

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](https://developer.salesforce.com/docs/component-library/documentation/en/lwc/reference_ui_api.html) 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](https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/data_service_create_record.htm).


:::::

:::::tab
Markdown content for specifications
:::::

::::::
