Define the smallest useful client-facing contract for a Dashboard page that is:
:db/syncThis link contract should sit on top of the real backbone:
rt.postgresxt.dbl/script :xtalk .clj modulesThe Dashboard link does not emit sync events.
It only:
:db/syncConceptual form:
(deflink.js Dashboard
{:queries {:summary summary-query
:members members-query}
:actions {:invite-member invite-member!
:remove-member remove-member!}
:listen ["Space" "Access" "AccessRole" "User"]})
The output of deflink.js should be a plain object spec.
The first runtime API should stay minimal.
{:data {:summary ...
:members ...}
:status :ready ;; or :loading | :acting | :error
:error nil}
{:load! fn
:set! fn
:act! fn}
Meaning:
load!
set!
act!
load!.:loading.:ready.act!.:acting.:db/sync.:db/sync.:ready.If action or refresh fails:
:error:error contains the failureThe page should only:
load!stateset!act!The page should not:
:db/sync directlyThe page/link layer should consume an operational layer that can be implemented
through l/script :xtalk .clj modules.
The first executable test target should be a link-level convergence test, not a full rendered page test.
load!.:status becomes :ready.act! :invite-member.:status becomes :acting.:db/sync.:status returns to :ready.(fact "dashboard link converges from server calls and :db/sync"
(let [link (dashboard-runtime/create
Dashboard
{:space-id "space-1"})]
(.load! link)
(:status (dashboard-runtime/state link))
=> :ready
(.act! link :invite-member
{:email "new@example.com"
:role "member"})
(:status (dashboard-runtime/state link))
=> :acting
(dashboard-runtime/apply-sync!
link
{:topic ":db/sync"
:tables ["AccessRole" "User"]})
(:status (dashboard-runtime/state link))
=> :ready))
This model is intentionally narrow.
It is enough to:
It avoids premature complexity in:
Implement the first Dashboard link runtime test against the first Space
vertical slice.
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 |