RefreshView API User Experience

Reliable content refresh is a fundamental web UX requirement and can be either user-driven or app-invoked.

A typical flow for a user-triggered refresh is:

  1. A Lightning web component displays a button (or other user interface control) to start a process that synchronizes the data being displayed in the component with its source.
  2. When the button is tapped, the button component dispatches a RefreshEvent event.
  3. The nearest level container component, which is registered with the RefreshView API, receives the RefreshEvent, stopping its propagation.
  4. The components’ refresh handlers initiate the refresh process on the appropriate components. They can display spinners, perform instrumentation, and do other things to prepare the UI to be refreshed.
  5. Descendant components of the handler participate in the refresh process through exposed API hooks. They can fetch data from a Salesforce org or perform other tasks to synchronize displayed data with the external data source.
  6. The refresh for the component hierarchy completes when all data is synchronized and updated onscreen.

For an app-triggered refresh:

  1. An application determines that a refresh is needed for a view to ensure the data is synchronized. For example, a refresh is needed after a reauthentication from an expired session, or after a pull-to-refresh action on a mobile UI.
  2. From this point, the refresh flow is similar to that described above for user-triggered refreshes.