This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-02-27
Channels
- # beginners (106)
- # boot (124)
- # cider (11)
- # clojure (105)
- # clojure-poland (2)
- # clojure-russia (28)
- # clojurescript (89)
- # core-async (14)
- # cursive (10)
- # datomic (7)
- # emacs (12)
- # garden (5)
- # hoplon (345)
- # immutant (127)
- # mount (2)
- # off-topic (24)
- # om (24)
- # onyx (8)
- # parinfer (51)
- # proton (2)
- # slack-help (4)
- # spacemacs (1)
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
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.
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?@bbss: you're passing the wrong data to db->tree
You cant expect that the same query will normalize two different data shapes
If you pass norm-data
everything should work
@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)
@bbss: yep, it's a bug, looking into a fix
@bbss: just submitted a patch that'll fix it
@bbss: meanwhile you can work around it by modifying the Leaf
component's query
to be: '[:id :width :height :color {:children ...}]
Anyone else noticed tempids get overwritten with nil
when migrating ?
solved it by implementing my own migrate
, apparently I needed to do some things outside the box
@tawus: you might find this link helpful https://github.com/maridonkers/om-next-datascript
I can't remember if they are building a todo app or not, but it's some food for thought
@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 .
Has anyone else here implemented routing for a dynamic route like, e.g., “/resource/:id”? Currently working through this and wanted to compare notes.
Om SE question: http://stackoverflow.com/questions/35675766/om-nexts-query-ast-and-ast-query-functions
And another one, in case there is interest: http://stackoverflow.com/questions/35675935/mixing-pure-react-components-with-om-next