Current view
One view for the page's lifetime; it recomputes when the data or its deps change.
const view = sales.item .$where(matchesFilters, [filters.$.dept, filters.$.organic, filters.$.search]) .$sort(bySortField, [filters.$.sort, filters.$.direction])
items
view.$length
units
view.quantity.$sum
avg price
view.price.$avg
price range
view.price.$min / $max
stock value
view.price × view.quantity
notes (all)
sales.$deep('note') .$length
Inventory
Rows come from view.subscribe; each row repaints from
item.subscribe. Controls write
filters.dept = ….
| type | dept | note item.note |
price | qty | organic |
|---|
Units by dept
sales.item.$where({ dept }).quantity.$sum — asking the same
path anywhere returns the same view. Click a bar to filter.
Outside writes
Plain DOM APIs, no e5x. Everything above still updates — the DOM is the source of truth.
The model, live
filters.subscribe +
sales.subscribe — both trees, serialized.