(async-action-bindings key
[state-bindings async-action-state-bindings
action-bindings]
state
action
&
body)
set up bindings for an async action definition
set up bindings for an async action definition
(async-action-handler key state action async-action-data-promise reaction-fn)
a promise-based async action handler providing a consistent
format for handling and recording emerging async-action-state
, and
for interacting with navigation
key
: the ::action/key
to match a dispatch
. identifies the action,
and is the default path of the async-action-state
in state
state
: the global stateaction
: the action value being handled
::action/path
- instead of updating the state
at key
,
update the state
at path
async-action-data-promise
: a promise of the action datareactino-fn
: a (fn <state>) to be called when the promise completes,
returning an effects mapasync-action-state
will be updated at ::action-path
with a map
with these keys:
::action/status
- ::inflight, ::success or ::error
::action/action
- the action value
::action/data
- the happy-path result of the action
::action/error
- any error value
a promise-based async action handler providing a consistent format for handling and recording emerging `async-action-state`, and for interacting with navigation - `key` : the `::action/key` to match a `dispatch`. identifies the action, and is the default path of the `async-action-state` in `state` - `state` : the global state - `action` : the action value being handled - `::action/path` - instead of updating the `state` at `key`, update the `state` at `path` - `async-action-data-promise` : a promise of the action data - `reactino-fn` : a (fn <state>) to be called when the promise completes, returning an effects map `async-action-state` will be updated at `::action-path` with a map with these keys: `::action/status` - ::inflight, ::success or ::error `::action/action` - the action value `::action/data` - the happy-path result of the action `::action/error` - any error value
(def-async-action key
[_state-bindings _async-action-state-bindings _action-bindings
:as bindings]
async-action-data-promise
reaction-map)
define an action handler to service a promise-based async action
an async-action-state
map will be initialised at a path in the global
state
map, and updated after the action has completed.
async-action-state
will have shape:
{::action/status
::inflight|::success|::error
::action/action
<action-map>
::action/data
<action-data>
::action/error
<action-error>
}
key
: the action key and the default path in the state
for
the async-action-state
state-bindings
: fn bindings to destructure the global state
mapasync-action-state-bindings
: fn bindings to destructure the async-action-state
mapaction-bindings
: fn bindings to destructure the action
mapasync-action-data-promise
: form returning a promise of the
<action-data>
- may use any established bindingsreaction-map
: form which will be evaluated when promise completes
returning effects including ::action/state
, ::action/dispatch
and
::action/navigate
define an action handler to service a promise-based async action an `async-action-state` map will be initialised at a path in the global `state` map, and updated after the action has completed. `async-action-state` will have shape: {`::action/status` `::inflight|::success|::error` `::action/action` `<action-map>` `::action/data` `<action-data>` `::action/error` `<action-error>`} - `key` : the action key and the default path in the `state` for the `async-action-state` - `state-bindings` : fn bindings to destructure the global `state` map - `async-action-state-bindings` : fn bindings to destructure the `async-action-state` map - `action-bindings` : fn bindings to destructure the `action` map - `async-action-data-promise` : form returning a promise of the `<action-data>` - may use any established bindings - `reaction-map` : form which will be evaluated when promise completes returning effects including `::action/state`, `::action/dispatch` and `::action/navigate`
(def-async-action-handler key
[_state-bindings _async-action-state-bindings
_action-bindings :as bindings]
async-action-data-promise
reaction-map
handler-fn)
a macro to establish bindings used by other async-action macros.
both def-async-action
and deepstate.action.axios/def-axios-action
defer to this macro to establish bindings
a macro to establish bindings used by other async-action macros. both [[def-async-action]] and [[deepstate.action.axios/def-axios-action]] defer to this macro to establish bindings
(navigate-always async-action-state url)
(navigate-always effs async-action-state url)
reaction helper - always navigate
reaction helper - always navigate
(navigate-on-error async-action-state url)
(navigate-on-error effs async-action-state url)
reaction helper - navigate only on error
reaction helper - navigate only on error
(navigate-on-inflight async-action-state url)
(navigate-on-inflight effs async-action-state url)
reaction helper - navigate only when inflight
reaction helper - navigate only when inflight
(navigate-on-success async-action-state url)
(navigate-on-success effs async-action-state url)
reaction helper - navigate only on success
reaction helper - navigate only on success
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close