Liking cljdoc? Tell your friends :D

fulcro.client.mutations


abort-idsclj/s

(abort-ids tx)

Returns a set of abort IDs from the given transaction.

Returns a set of abort IDs from the given transaction.
raw docstring

defmutationclj/smacro

(defmutation & args)

Define a Fulcro mutation.

The given symbol will be prefixed with the namespace of the current namespace, as if it were def'd into the namespace.

The arglist should be the parameter arglist of the mutation, NOT the complete argument list for the equivalent defmethod. For example:

(defmutation boo [{:keys [id]} ...) => (defmethod m/mutate ns/boo [{:keys [state ref]} _ {:keys [id]}] ...)

The mutation may include any combination of action and any number of remotes (by the remote name).

If action is supplied, it must be first.

(defmutation boo "docstring" [params-map] (action [env] ...) (my-remote [env] ...) (other-remote [env] ...) (remote [env] ...))

There is special support for placing the action as a var in the namespace. This support only work when using a plain symbol. Simple add :intern metadata to the symbol. If the metadata is true, it will intern the symbol as-is. It it is a string, it will suffix the symbol with that string. If it is a symbol, it will use that symbol. The interned symbol will act like the action side of the mutation, and has the signature: (fn [env params]). This is also useful in devcards for using mkdn-pprint-source on mutations, and should give you docstring and navigation support from nREPL.

Define a Fulcro mutation.

The given symbol will be prefixed with the namespace of the current namespace, as if
it were def'd into the namespace.

The arglist should be the *parameter* arglist of the mutation, NOT the complete argument list
for the equivalent defmethod. For example:

   (defmutation boo [{:keys [id]} ...) => (defmethod m/mutate *ns*/boo [{:keys [state ref]} _ {:keys [id]}] ...)

The mutation may include any combination of action and any number of remotes (by the remote name).

If `action` is supplied, it must be first.

(defmutation boo "docstring" [params-map]
  (action [env] ...)
  (my-remote [env] ...)
  (other-remote [env] ...)
  (remote [env] ...))

There is special support for placing the action as a var in the namespace. This support
only work when using a plain symbol. Simple add `:intern` metadata to the symbol. If
the metadata is true, it will intern the symbol as-is. It it is a string, it will suffix
the symbol with that string. If it is a symbol, it will use that symbol. The interned
symbol will act like the action side of the mutation, and has the signature:
`(fn [env params])`. This is also useful in devcards for using mkdn-pprint-source on mutations,
and should give you docstring and navigation support from nREPL.
raw docstring

integrate-ident*clj/s

(integrate-ident* state ident & named-parameters)

Integrate an ident into any number of places in the app state. This function is safe to use within mutation implementations as a general helper function.

The named parameters can be specified any number of times. They are:

  • append: A vector (path) to a list in your app state where this new object's ident should be appended. Will not append the ident if that ident is already in the list.
  • prepend: A vector (path) to a list in your app state where this new object's ident should be prepended. Will not append the ident if that ident is already in the list.
  • replace: A vector (path) to a specific location in app-state where this object's ident should be placed. Can target a to-one or to-many. If the target is a vector element then that element must already exist in the vector.
Integrate an ident into any number of places in the app state. This function is safe to use within mutation
implementations as a general helper function.

The named parameters can be specified any number of times. They are:

- append:  A vector (path) to a list in your app state where this new object's ident should be appended. Will not append
the ident if that ident is already in the list.
- prepend: A vector (path) to a list in your app state where this new object's ident should be prepended. Will not append
the ident if that ident is already in the list.
- replace: A vector (path) to a specific location in app-state where this object's ident should be placed. Can target a to-one or to-many.
 If the target is a vector element then that element must already exist in the vector.
raw docstring

is-call?clj/s

(is-call? expr)

mutateclj/smultimethod


post-mutateclj/smultimethod


progressive-update-transactionclj/s

(progressive-update-transaction network-transaction progress)

Given a remote transaction containing one or more remote mutations, returns a local transaction of zero or more mutations that should be run to provide a progress update. The progress argument will be added to each resulting mutation in parameters as :fulcro.client.network/progress.

Given a remote transaction containing one or more remote mutations, returns a local transaction of zero or
more mutations that should be run to provide a progress update. The `progress` argument will be added to
each resulting mutation in parameters as `:fulcro.client.network/progress`.
raw docstring

remove-ident*clj/s

(remove-ident* state-map ident path-to-idents)

Removes an ident, if it exists, from a list of idents in app state. This function is safe to use within mutations.

Removes an ident, if it exists, from a list of idents in app state. This
function is safe to use within mutations.
raw docstring

returningclj/s

(returning ast state class)

Indicate the the remote operation will return a value of the given component type. The server-side mutation need simply return a tree matching that component's query and it will auto-merge into state. The ast param MUST be a query ast containing exactly one mutation that is not already a mutation join. The state is required for looking up dynamic queries, and may be nil if you use only static queries.

Indicate the the remote operation will return a value of the given component type. The server-side mutation need
simply return a tree matching that component's query and it will auto-merge into state. The ast param MUST be a query ast
containing exactly one mutation that is *not* already a mutation join. The state is required for looking up dynamic queries, and
may be nil if you use only static queries.
raw docstring

set-integer!clj/s

(set-integer! component field & {:keys [event value]})

Set the given integer on the given field of a component. Allows same parameters as set-string!.

It is recommended you use this function only on UI-related data (e.g. data that is used for display purposes) and write clear top-level transactions for anything else. Calls to this are compressed in history.

Set the given integer on the given `field` of a `component`. Allows same parameters as `set-string!`.

It is recommended you use this function only on UI-related data (e.g. data that is used for display purposes)
and write clear top-level transactions for anything else. Calls to this are compressed in history.
raw docstring

set-string!clj/s

(set-string! component field & {:keys [event value]})

Set a string on the given field of a component. The string can be literal via named parameter :value or can be auto-extracted from a UI event using the named parameter :event

Examples

(set-string! this :ui/name :value "Hello") ; set from literal (or var)
(set-string! this :ui/name :event evt) ; extract from UI event target value

It is recommended you use this function only on UI-related data (e.g. data that is used for display purposes) and write clear top-level transactions for anything else. Calls to this are compressed in history.

Set a string on the given `field` of a `component`. The string can be literal via named parameter `:value` or
can be auto-extracted from a UI event using the named parameter `:event`

Examples

```
(set-string! this :ui/name :value "Hello") ; set from literal (or var)
(set-string! this :ui/name :event evt) ; extract from UI event target value
```

It is recommended you use this function only on UI-related
data (e.g. data that is used for display purposes) and write clear top-level transactions for anything else.
Calls to this are compressed in history.
raw docstring

set-value!clj/s

(set-value! component field value)

Set a raw value on the given field of a component. It is recommended you use this function only on UI-related data (e.g. form inputs that are used by the UI, and not persisted data). Changes made via these helpers are compressed in the history.

Set a raw value on the given `field` of a `component`. It is recommended you use this function only on
UI-related data (e.g. form inputs that are used by the UI, and not persisted data). Changes made via these
helpers are compressed in the history.
raw docstring

target-valueclj/s

(target-value evt)

toggle!clj/s

(toggle! comp field)

Toggle the given boolean field on the specified component. It is recommended you use this function only on UI-related data (e.g. form checkbox checked status) and write clear top-level transactions for anything more complicated.

Toggle the given boolean `field` on the specified component. It is recommended you use this function only on
UI-related data (e.g. form checkbox checked status) and write clear top-level transactions for anything more complicated.
raw docstring

with-abort-idclj/s

(with-abort-id ast id)

Modifies the mutation to enable network-level aborts. The id is a user-defined ID (any type) that identifies things that can be aborted on networking. IDs need not be unique per node, though aborting an ID that refers to more than one in-flight request will abort them all.

Modifies the mutation to enable network-level aborts. The id is a user-defined ID (any type) that identifies
things that can be aborted on networking. IDs need not be unique per node, though aborting an ID that refers to
more than one in-flight request will abort them all.
raw docstring

with-paramsclj/s

(with-params ast params)

Modify an AST containing a single mutation, changing it's parameters to those given as an argument.

Modify an AST containing a single mutation, changing it's parameters to those given as an argument.
raw docstring

with-progressive-updatesclj/s

(with-progressive-updates ast progress-mutation)

Modifies the AST node to enable progressive updates (if available) about the response download progress. progress-mutation is a call expression (e.g. (f {})) for a mutation, which can include the normal parameter map. This mutation mutation will be triggered on each progress step. It will receive one call when the request is sent, followed by zero or more progress events from the low-level network layer, and one call when the request is done (with any status). The first and last calls are guaranteed.

An extra parameter keyed at fulcro.client.network/progress will be included that contains a :progress key (:sending, :receiving, :complete, or :failed), and a status that will be dependent on the network implementation (e.g. a google XhrIO progress event).

Modifies the AST node to enable progressive updates (if available) about the response download progress.
`progress-mutation` is a call expression (e.g. `(f {})`) for a mutation, which can include the normal parameter
map. This mutation mutation will be triggered on each progress step. It will receive
one call when the request is sent, followed by zero or more progress events from the low-level network layer,
and one call when the request is done (with any status). The first and last calls are guaranteed.

An extra parameter keyed at `fulcro.client.network/progress` will be included that contains a :progress key
(:sending, :receiving, :complete, or :failed), and a status that will be dependent on the network implementation
(e.g. a google XhrIO progress event).
raw docstring

with-targetclj/s

(with-target ast target)

Set's a target for the return value from the mutation to be merged into. This can be combined with returning to define a path to insert the new entry.

Set's a target for the return value from the mutation to be merged into. This can be combined with returning to define
a path to insert the new entry.
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close