core.medplumclient.notifyresourcemodified
Home > @medplum/core > MedplumClient > notifyResourceModified
MedplumClient.notifyResourceModified() method
Notifies listeners that a resource was modified outside of the standard CRUD methods, and invalidates the relevant cached values.
The client emits the resourceModified event automatically for createResource, updateResource, patchResource, deleteResource, and related methods. Use this method to announce modifications the client cannot classify itself, such as custom operations, GraphQL mutations, or out-of-band changes:
await medplum.post(medplum.fhirUrl('Appointment', '$book'), parameters);
medplum.notifyResourceModified({ resourceType: 'Appointment', operation: 'create' });
medplum.notifyResourceModified({ resourceType: 'Slot', operation: 'update' });
Cached searches for the resource type are invalidated. If event.resource is provided for a non-delete operation, it becomes the cached read value; otherwise, if event.id is provided, the cached read is invalidated.
Signature:
notifyResourceModified(event: ResourceModifiedEvent): void;
Parameters
Parameter | Type | Description |
|---|---|---|
event | The resource modification to announce. |
Returns:
void