The component context: how it is built from what the client sent, and how removed memory keys become client-side signal removals. Pure functions over plain data: no request, no channels.
The component context: how it is built from what the client sent, and how removed memory keys become client-side signal removals. Pure functions over plain data: no request, no channels.
(add-removal-nils old new)Returns new-memory augmented with nil entries for every key (recursively) present in old-memory but absent in new. nil serializes to JSON null, which Datastar's RFC 7386 merge-patch deletes from the client signal store — so a plain dissoc on :memory becomes a real client-side signal removal. Vectors are atomic (replaced wholesale, never recursed into), matching merge-patch array semantics. Framework contract: renderers must treat nil and absent memory keys identically.
Returns new-memory augmented with nil entries for every key (recursively) present in old-memory but absent in new. nil serializes to JSON null, which Datastar's RFC 7386 merge-patch deletes from the client signal store — so a plain dissoc on :memory becomes a real client-side signal removal. Vectors are atomic (replaced wholesale, never recursed into), matching merge-patch array semantics. Framework contract: renderers must treat nil and absent memory keys identically.
(coerce-state state)The FSM state as keywords: signals bring it back as a string (or a vector of strings for a hierarchical state).
The FSM state as keywords: signals bring it back as a string (or a vector of strings for a hierarchical state).
(initial-ctx {:keys [logged-user app-config request-method]}
signals
component-id
component-route
initial-state)The ctx an event starts from, built from the component's own slice of the
client's signals (signals: its :memory plus :state, or nil) and the
per-request values (request-ctx: :logged-user, and :app-config /
:request-method when the request had them). Without a :state in the
signals the machine's initial-state is used. :component-route lets
actions build URLs for this component without hardcoding them.
The ctx an event starts from, built from the component's own slice of the client's signals (`signals`: its `:memory` plus `:state`, or nil) and the per-request values (`request-ctx`: `:logged-user`, and `:app-config` / `:request-method` when the request had them). Without a `:state` in the signals the machine's `initial-state` is used. `:component-route` lets actions build URLs for this component without hardcoding them.
(with-removal-nils initial-ctx ctx)ctx with every memory key initial-ctx had and the transition removed
re-added as nil, so the render's data-signals deletes it client-side.
`ctx` with every memory key `initial-ctx` had and the transition removed re-added as nil, so the render's `data-signals` deletes it client-side.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |