Fork me on GitHub
#om
<
2016-04-30
>
iwankaramazow06:04:02

@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)}]))

dimiter12:04:11

Can someone let me know why the following does not work.

dimiter12:04:21

I have the following component which I want to kick off a remote read when mounted on initial page load.

dimiter12:04:55

(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)))))))

dimiter12:04:13

I can see the remote read happening in the Chrome inspector, but it looks like it is not making it into the component.

dimiter12:04:58

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.

dimiter12:04:08

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

petterik14:04:25

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.

tomjack15:04:00

that's the error when you try to call zip/node on nil

petterik15:04:15

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.

anmonteiro15:04:19

@petterik: would be interested in seeing a minimal repro

anmonteiro15:04:15

Seems like bug in a recent patch

petterik16:04:38

@anmonteiro: I'm taking a day off tomorrow, but I'll let you know what I come up with

tomjack17:04:40

since the beginning normalize has assumed joins are homogeneous wrt (comp first ident)

anmonteiro17:04:06

joins are homogeneous

anmonteiro17:04:24

if you want to model heterogeneity use unions

tomjack17:04:54

I was thinking of using unions in some places, joins in others, over the same data. I will just try not do that simple_smile

dimiter17:04:29

So what is the best way of loading data from remotes on initial load. Having trouble in my example above.

blissdev19:04:43

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?

dimiter19:04:38

This tutorial helped me figure some stuff out:

dimiter19:04:14

Here is another template that has some extra pieces.

blissdev19:04:33

dimiter: thanks, that’s helpful

madvas19:04:09

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

dimiter21:04:03

Can a sub-component make a remote read query independent of the root reconciler.'

dimiter23:04:57

Looks like when remote read called by a sub-component is called, the component does not render with the merged properties automatically.