app-dbre-frame-query stores all its state inside your re-frame app-db under two
namespaced keys. This means query state is fully inspectable with
re-frame-10x, serializable, and
compatible with time-travel debugging.
;; Your app-db will look like:
{;; ... your own app state ...
:my-app/route [:home]
:my-app/user {:id 42 :name "Alice"}
;; ┌─── re-frame-query state ─────────────────────────────────────────┐
:re-frame.query/queries
{[:todos/list {:user-id 42}] ;; ← query-id = [key params]
{:status :success
:data [{:id 1 :title "Ship it"} {:id 2 :title "Write docs"}]
:error nil
:fetching? false
:stale? false
:active? true ;; ← a component is subscribed
:fetched-at 1718900000000
:tags #{[:todos :user 42]}
:stale-time-ms 30000
:cache-time-ms 300000}
[:todos/list {:user-id 7}]
{:status :loading :data nil :fetching? true ,,,}}
:re-frame.query/mutations
{[:todos/add {:user-id 42 :title "New"}]
{:status :success
:data {:id 3 :title "New"}
:error nil}}
;; └──────────────────────────────────────────────────────────────────┘
}
app-db key | Shape | Description |
|---|---|---|
:re-frame.query/queries | {[k params] → query-map} | Cache of all fetched queries. Each entry is a query-id ([key params]) mapped to the query state shape. |
:re-frame.query/mutations | {[k params] → mutation-map} | Status of in-flight and completed mutations. Each entry has :status, :data, and :error. |
:re-frame.query/*) won't collide with your own state.:re-frame.query/queries to see every cached query, its status, data, and tags.app-db), so your db remains serializable for time-travel and persistence.assoc, merge, or reset! your own keys alongside it.Can you improve this documentation?Edit on GitHub
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 |