notifyRecordUpdateAvailable(recordIds)

Informs Lightning Data Service that record data has changed so that Lightning Data Service can take the appropriate actions to keep wire adapters updated with the latest record data. Call this function to notify Lightning Data Service that a record has changed outside its mechanisms, such as via imperative Apex or by calling User Interface API via a third-party framework. This function supersedes getRecordNotifyChange(recordIds).

  • items—(Required) An array of objects with an object shape of { recordId: string }. The record ID can be either 15 or 18 characters long, and it must be from a supported object.

A Promise object that is resolved when Lightning Data Service has completed its processing. Updated information is sent to all affected wire adapters before the Promise is resolved. Use the Promise to determine when Lightning Data Service has completed its processing. The resolved value of the Promise is void.

Calling notifyRecordUpdateAvailable(recordIds) signals that the data for the provided recordIds has changed, so that the Lightning Data Service cache and wires can be updated.

Unlike getRecordNotifyChange(recordIds) (Deprecated), notifyRecordUpdateAvailable(recordIds) considers the record data wired by all instantiated components. For every wire that uses record data from one of the supplied recordIds, Lightning Data Service obtains fresh data for the wire and re-emits updated values to the wire if the data has changed. Values are not re-emitted to wires whose data has not changed, per the usual semantics of @wire.

This example calls notifyRecordUpdateAvailable() after the record is updated via calling an Apex method imperatively.

To ensure that notifyRecordUpdateAvailable() is called after the record update via Apex, use the async/await pattern or a Promise chain.

If you’re using an @wire to get record data via an Apex method, simply call refreshApex(), which uses the configuration bound to the @wire to get the data and update the cache.

notifyRecordUpdateAvailable() signals to LDS that some records are stale and refreshes those records that are in the LDS cache.

The lwc-recipes repo has an ldsNotifyRecordUpdateAvailable component that demonstrates notifyRecordUpdateAvailable usage .

See Also