Ash extension for Lavash resource configuration.
This extension allows you to configure fine-grained PubSub invalidation directly on your Ash resources.
Usage
defmodule MyApp.Product do
use Ash.Resource,
extensions: [Lavash.Resource]
lavash do
notify_on [:category_id, :in_stock]
end
endOptions
notify_on- List of attributes to broadcast changes for. When a mutation changes any of these attributes, Lavash will broadcast to combination topics so that LiveViews filtering on these attributes can be notified.
How it works
When a form submits and mutates a resource with notify_on configured:
- Lavash extracts the old and new values for each
notify_onattribute - Broadcasts to all subset combinations of those attribute values
- LiveViews subscribed to matching combination topics receive invalidation
This enables fine-grained cache invalidation - only LiveViews whose current filters match the changed record will be refreshed.
Summary
Functions
Returns the notify_on attributes for a resource, or empty list if not configured.