Skip to content

Instantly share code, notes, and snippets.

@eyston

eyston/path.cljs Secret

Last active February 7, 2016 09:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eyston/89f1d4b883cc1c293dda to your computer and use it in GitHub Desktop.
Save eyston/89f1d4b883cc1c293dda to your computer and use it in GitHub Desktop.
(defui Employee
static om/Ident
(ident [_ {:keys [id]}]
[:person/by-id id])
static om/IQuery
(query [this]
[:id :name])
Object
(render [this]
;; om/full-query throws
;; "No queries exist for component path (om-tutorial.ping/People om-tutorial.ping/Employee) or data path [[:person/by-id 2]]"
(println "full-query" (om/full-query this))
(dom/div nil
(dom/pre nil (.stringify js/JSON (clj->js (om/props this)) nil 2)))))
(def employee (om/factory Employee))
(defui People
static om/IQuery
(query [this]
[{[:person/by-id 2] (om/get-query Employee)}])
Object
(render [this]
(dom/div nil
(employee (-> this om/props (get [:person/by-id 2]))))))
;; indexer output at that class path
#{[[:id :name]
{:l [[:person/by-id 2]],
:pnodes
[[{[:person/by-id 2] [:id :name]}]
{[:person/by-id 2] [:id :name]}
[[:person/by-id 2] [:id :name]]],
:ppath
{:l [],
:pnodes
[[{[:person/by-id 2] [:id :name]}]
{[:person/by-id 2] [:id :name]}],
:ppath
{:l [],
:pnodes [[{[:person/by-id 2] [:id :name]}]],
:ppath nil,
:r nil},
:r nil},
:r nil}]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment