Liking cljdoc? Tell your friends :D

com.fulcrologic.fulcro.algorithms.tempid

Functions for making and consuming Fulcro temporary IDs. Tempids are used when the client is optimistically creating a new entity and you want to be able to detect that on the server when the data is sent. Additionally, Fulcro mutations can return a remapping instruction from the server to rewrite all tempids in the client (state, network queues, etc.) atomically.

This allows the client to safely generate new entities with a temporary ID and let the server remap them to the real IDs at some future time. Transit read/write is included, so that (de)serialization of them can be consistent whenever needed (see the transit ns in this package).

Functions for making and consuming Fulcro temporary IDs. Tempids are used when the client is optimistically
creating a new entity and you want to be able to detect that on the server when the data is sent. Additionally,
Fulcro mutations can return a remapping instruction from the server to rewrite all tempids in the client
(state, network queues, etc.) atomically.

This allows the client to safely generate new entities with a temporary ID and let the server remap them to the real
IDs at some future time.  Transit read/write is included, so that (de)serialization of them can be consistent whenever
needed (see the `transit` ns in this package).
raw docstring

resolve-tempidsclj/s

(resolve-tempids data-structure tid->rid)

Replaces all tempids in data-structure using the tid->rid map. This is just a deep walk that replaces every possible match of tid with rid.

tid->rid must be a map, as this function optimizes away resolution by checking if the map is empty.

Returns the data structure with everything replaced.

Replaces all tempids in `data-structure` using the `tid->rid` map.  This is just a deep
walk that replaces every possible match of `tid` with `rid`.

`tid->rid` must be a map, as this function optimizes away resolution by checking if
the map is empty.

Returns the data structure with everything replaced.
sourceraw docstring

resolve-tempids!clj/s

(resolve-tempids! {:com.fulcrologic.fulcro.application/keys [state-atom
                                                             runtime-atom]}
                  tx-result)

Resolve all of the mutation tempid remappings in the tx-result against the given app.

app - The fulcro app tx-result - The transaction result (the body map, not the internal tx node).

This function rewrites all tempids in the app state and runtime transaction queues.

NOTE: This function assumes that tempids are distinctly recognizable (e.g. are TempIds or guids). It is unsafe to use this function if you're using something else for temporary IDs as this function might rewrite things that are not IDs.

Resolve all of the mutation tempid remappings in the `tx-result` against the given `app`.

app - The fulcro app
tx-result - The transaction result (the body map, not the internal tx node).

This function rewrites all tempids in the app state and runtime transaction queues.

NOTE: This function assumes that tempids are distinctly recognizable (e.g. are TempIds or
guids).  It is unsafe to use this function if you're using something else for temporary IDs
as this function might rewrite things that are not IDs.
sourceraw docstring

result->tempid->realidclj/s

(result->tempid->realid tx-result)

Find and combine all of the tempid remappings from a standard fulcro transaction response.

Find and combine all of the tempid remappings from a standard fulcro transaction response.
sourceraw docstring

tagclj/s

source

tempidclj/s≠

clj
(tempid)
(tempid uuid)
cljs
(tempid)
(tempid id)

Create a new tempid.

Create a new tempid.
source (clj)source (cljs)raw docstring

tempid?clj/s

(tempid? x)

Returns true if the given x is a tempid.

Returns true if the given `x` is a tempid.
sourceraw docstring

uuidclj/s≠

clj
(uuid)
(uuid n)
cljs
(uuid)
(uuid & args)

Generate a UUID. With no args returns a random UUID. with an arg (numeric) it generates a stable one based on that number (useful for testing). Works in cljc.

Generate a UUID. With no args returns a random UUID. with an arg (numeric)
it generates a stable one based on that number (useful for testing). Works in cljc.
sourceraw docstring

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

× close