The algorithm and support functions for converting a normalized Fulcro database to a tree of denormalized props.
The algorithm and support functions for converting a normalized Fulcro database to a tree of denormalized props.
(db->tree query starting-entity state-map)
Pull a tree of data from a fulcro normalized database as a tree corresponding to the given query.
query - EQL. starting-entity - A map of data or ident at which to start. state-map - The overall normalized database from which idents can be resolved.
Returns a tree of data where each resolved data node is also marked with the current
denormalize-time (dynamically bound outside of this call). Users of this function that
are hydrating the UI should ensure that this time is bound to Fulcro's current internal
basis-time using binding
.
Pull a tree of data from a fulcro normalized database as a tree corresponding to the given query. query - EQL. starting-entity - A map of data or ident at which to start. state-map - The overall normalized database from which idents can be resolved. Returns a tree of data where each resolved data node is also marked with the current *denormalize-time* (dynamically bound outside of this call). Users of this function that are hydrating the UI should ensure that this time is bound to Fulcro's current internal basis-time using `binding`.
(denormalization-time props)
Gets the time at which the given props were processed by db->tree
, if known.
Gets the time at which the given props were processed by `db->tree`, if known.
(denormalize {:keys [type children] :as top-node}
current-entity
state-map
idents-seen)
Internal implementation of db->tree
. You should normally use db->tree
instead of this function.
top-node
: an AST for the query.current-entity
: The entity to start denormalization from.state-map
: a normalized database.idents-seen
: a map of the idents seen so far (for recursion loop tracking).Internal implementation of `db->tree`. You should normally use `db->tree` instead of this function. - `top-node`: an AST for the query. - `current-entity`: The entity to start denormalization from. - `state-map`: a normalized database. - `idents-seen`: a map of the idents seen so far (for recursion loop tracking).
(follow-ref state-map [table id :as ref])
Returns the value defined by the ref
from state-map
. Works for link refs and
lookup refs.
Returns the value defined by the `ref` from `state-map`. Works for link refs and lookup refs.
(link-ref? v)
Is the given v
a link ref query (e.g. `[:table '_]) element.
Is the given `v` a link ref query (e.g. `[:table '_]) element.
(lookup-ref? v)
Is the given v
a lookup ref query (i.e. ident)?
Is the given `v` a lookup ref query (i.e. ident)?
(ref-key [table id :as ref])
Returns the key to use in results for the given ref (ident of lookup ref). For link refs this is just the first element, and for idents it is the ident.
Returns the key to use in results for the given ref (ident of lookup ref). For link refs this is just the first element, and for idents it is the ident.
(with-time props t)
Associates time metadata with the given props. This time can be used by rendering optimizations to decide when stale props are passed to it from a parent in cases where props tunnelling was used for localized refresh.
Associates time metadata with the given props. This time can be used by rendering optimizations to decide when stale props are passed to it from a parent in cases where props tunnelling was used for localized refresh.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close