This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-04-30
Channels
- # admin-announcements (3)
- # arachne (8)
- # beginners (5)
- # boot (52)
- # braveandtrue (4)
- # cider (17)
- # cljsrn (1)
- # clojure (36)
- # clojure-dusseldorf (2)
- # clojure-india (1)
- # clojure-russia (30)
- # clojure-uk (1)
- # clojurebridge (1)
- # clojurescript (47)
- # clojutre (1)
- # component (1)
- # core-async (3)
- # cursive (5)
- # datascript (1)
- # datomic (4)
- # emacs (1)
- # error-message-catalog (62)
- # garden (3)
- # hoplon (16)
- # jobs (5)
- # luminus (11)
- # mount (1)
- # om (32)
- # onyx (17)
- # spacemacs (4)
- # untangled (20)
- # yada (4)
@dimiter: you might encounter that error a lot until you know how Om's query composition works 😉
No queries exist...
indicates your query isn't valid. In 99% of the cases you probably wrote something like this:
(defui Child
static om/IQuery
(query [_]
[:a :b :c]))
(defui Parent
static om/IQuery
(query [_]
(om/get-query Child)))
You probably think: hey, Parent
needs the exact same query of Child, let's just take that query...
This won't work, a.k.a you're stealing
queries. Under the hood this will result in an invalid graph, Om can only walk valid graphs.
Hence the error message no queries exist for component path
Solution?
Compose those queries with a join
(defui Child
static om/IQuery
(query [_]
[:a :b :c]))
(defui Parent
static om/IQuery
(query [_]
[{:child (om/get-query Child)}]))
I have the following component which I want to kick off a remote read when mounted on initial page load.
(defui AutoCompleter
static om/IQueryParams
(params [this]
{:query ""})
static om/IQuery
(query [_]
'[(:search/results {:query ?query})])
Object
(componentWillMount [this]
(om/set-query! this {:params {:query "Dimiter"}}))
(render [this]
(println (om/props this))
(println (om/tempid))
(let [{:keys [search/results]} (om/props this)]
(dom/div nil
(dom/h2 nil (str (om/get-params this)))
(cond->
[(search-field this (:query (om/get-params this)))]
(not (empty? results)) (conj (result-list results)))))))
I can see the remote read happening in the Chrome inspector, but it looks like it is not making it into the component.
What is interesting, is that if I start off on a different route, for example http://localhost:3000/potato, and then navigate to the root, everything works fine.
In any case, the idea is that I have some restful routes like http://localhost:3000/remedy/object_type/id and perform a remote read with id and object as the query
I'm getting Cannot read property 'call' of null
when I use (om/set-query! this {:query (om/query this)})
for one of my components in alpha34.
Here's part of the stack:
clojure$zip$node zip.cljs:62
om$next$cascade_query next.cljs:980
...
om$next$set_query_BANG_ next.cljs:645
Anyone else getting this? I can send more info if anyone is interested. I find it hard to debug this part, since I don't understand zippers that well.Yeah, but why would it happen? I've tried with different queries. Mix of 1-to-1 joins, 1-to-many joins, with and without params.
@petterik: would be interested in seeing a minimal repro
Seems like bug in a recent patch
@anmonteiro: I'm taking a day off tomorrow, but I'll let you know what I come up with
https://github.com/omcljs/om/commit/acb29dc447#diff-7e4043f05bbd8e76d2da4614c2566cfaR863
since the beginning normalize has assumed joins are homogeneous wrt (comp first ident)
joins are homogeneous
if you want to model heterogeneity use unions
I was thinking of using unions in some places, joins in others, over the same data. I will just try not do that
So what is the best way of loading data from remotes on initial load. Having trouble in my example above.
For someone with om.prev experience, what is the best path to getting up to speed with om.next? Should I start with the Quick Start and work my way through the wiki documentation? I know there’s some quality 3rd party posts/documentation out there, should I do that afterwards?
Guys, now you can use material-ui with Om/Om.Next without painful setup with my new library 😉 https://github.com/madvas/cljs-react-material-ui