Clojurians
#om
<
2016-02-27
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

george.w.singer00:02:42

I'm trying to figure out what an ast is literally represented as in om next. I'm assuming it's a map? Typing in (om.next/query->ast '[(:foo {:bar 1})]) into a repl yields a "function undeclared" error in a REPL

noonian03:02:27

Yes, an ast is a map. Im not sure about your error but in your parser read fns there will be an ast key in the env map containing the ast representation for all of your apps root query expressions.

tawus04:02:46

Is there a todo app using om.next and datascript?

bbss04:02:00

I am trying to do a round-trip tree->db and db->tree in a recursive query but I can't get it to work. When using @anmonteiro 's example like this I would expect it to work:

(def norm-data (om/tree->db
                 (om/get-query CompositeApp)
                 composite-data true))
;is normalized as expected
(om/db->tree (om/get-query CompositeApp)
             (:composite/item norm-data) norm-data)
;returns just {}
Is this not implemented yet or am I getting something wrong?

anmonteiro11:02:16

@bbss: you're passing the wrong data to db->tree

anmonteiro11:02:07

You cant expect that the same query will normalize two different data shapes

anmonteiro11:02:26

If you pass norm-data everything should work

bbss12:02:17

@anmonteiro: that's what I tried first but that gives me a null pointer:

#object[TypeError TypeError: Cannot read property 'call' of null, a sanity hint:
/**
 * Returns the node at loc
 */
clojure.zip.node = (function clojure$zip$node(loc){
return loc <<< ☢ NULL ☢ <<< .call(null,(0));]
	 clojure.zip/node (jar:file:/Users/baruchberger/.m2/repository/org/clojure/clojurescript/1.7.170/clojurescript-1.7.170.jar!/clojure/zip.cljs:62:10)
	 om$next$query_template_$_query_template_STAR_ (jar:file:/Users/baruchberger/.m2/repository/org/omcljs/om/1.0.0-alpha31-SNAPSHOT/om-1.0.0-alpha31-SNAPSHOT.jar!/om/next.cljs:110:27)
	 om.next/query-template (jar:file:/Users/baruchberger/.m2/repository/org/omcljs/om/1.0.0-alpha31-SNAPSHOT/om-1.0.0-alpha31-SNAPSHOT.jar!/om/next.cljs:129:6)
	 om$next$reduce_query_depth (jar:file:/Users/baruchberger/.m2/repository/org/omcljs/om/1.0.0-alpha31-SNAPSHOT/om-1.0.0-alpha31-SNAPSHOT.jar!/om/next.cljs:1265:14)
	 cljs.core.map.cljs$core$IFn$_invoke$arity$2 (jar:file:/Users/baruchberger/.m2/repository/org/clojure/clojurescript/1.7.170/clojurescript-1.7.170.jar!/cljs/core.cljs:4215:30)
	 cljs.core.LazySeq.sval (jar:file:/Users/baruchberger/.m2/repository/org/clojure/clojurescript/1.7.170/clojurescript-1.7.170.jar!/cljs/core.cljs:3010:18)
	 cljs.core.LazySeq.cljs$core$ISeqable$_seq$arity$1 (jar:file:/Users/baruchberger/.m2/repository/org/clojure/clojurescript/1.7.170/clojurescript-1.7.170.jar!/cljs/core.cljs:3052:12)
	 cljs$core$seq (jar:file:/Users/baruchberger/.m2/repository/org/clojure/clojurescript/1.7.170/clojurescript-1.7.170.jar!/cljs/core.cljs:1075:25)

anmonteiro13:02:46

@bbss: yep, it's a bug, looking into a fix

bbss13:02:07

okay thanks! :simple_smile:

anmonteiro13:02:25

@bbss: just submitted a patch that'll fix it

bbss13:02:50

great, so fast :simple_smile:

anmonteiro13:02:10

@bbss: meanwhile you can work around it by modifying the Leaf component's query

anmonteiro13:02:13

to be: '[:id :width :height :color {:children ...}]

bbss13:02:32

oh, that simple :smile:

bbss14:02:51

yeah, that did the trick, for my own code too, thanks again

iwankaramazow17:02:15

Anyone else noticed tempids get overwritten with nil when migrating ?

iwankaramazow18:02:43

solved it by implementing my own migrate, apparently I needed to do some things outside the box

futuro19:02:37

I can't remember if they are building a todo app or not, but it's some food for thought

futuro19:02:44

@thiagofm: I'm a little late to the party, but if you haven't checked out the datomic find syntax docs http://docs.datomic.com/query.html#find-specifications, I recommend it. You might be able to get rid of the calls to first and ffirst by changing :find ?id ?e to :find [?id ?e] and :find ?e to :find ?e .

bnoguchi20:02:28

Has anyone else here implemented routing for a dynamic route like, e.g., “/resource/:id”? Currently working through this and wanted to compare notes.