-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Labels
Description
Similar to Sul or Om/next.
Just a rough sketch of what it might look like:
(defn my-com [data owner opts]
(reify
dato/IParams
(params [_]
{:tasks {:qes-by :task/title}
:me {:qe-by :user/me? true}
;; Bit tricky w/ dep graph, something like prismatic fnk might enable this
:local-session {:qe-by :session/user-id my-id}
:filtered-task-ids {:q '[:find ?eid :in $ ?title-filter :where [?eid :task/title (re-match ?title-filter)]
:current-company {:entity company-eid}
:cases {:entities [case-eids]})
dato/IRender
(render [_]
(let [data (dato/com-data owner)]
....))- The inputs required to instantiate
my-comwould be{:company-eid ... :title-filter #"..." :case-eids [...] :my-id ...}(and the current db at render time), - the value of
datainrenderwould have the same structure as specified inIParams
Other completely dynamic queries could be done in the render method if necessary, but whereas with the above format we can take care of (however inefficiently) automatically updating the component, it would the be up to the developer to make sure that listeners were added/removed on IWillMount and IWillUnmount for said dynamic queries.