Found today that we can't close over locals in the clj
version of ui
.
(let [a 1]
(ui Object (render [this] a)))
;; => CompilerException java.lang.RuntimeException: Unable to resolve symbol: a in this context
Seems like it's not possible to close over locals vars with defrecord
Could you try something like
(let [foo (ui Object (render [this] (:a this)))] (assoc foo :a "bar"))
?
ui
returns a function which takes props and stuff, not an instance of the record:
(assoc (om/ui Object (render [this] (:a this))) :a 1)
ClassCastException clojure.lang.AFunction$1 cannot be cast to clojure.lang.Associative
Created a macro om-ui
which defines vars and replaces the vars for new generated symbols in the body passed to om.next/ui
:
https://gist.github.com/petterik/28c2fff796edbf4aa12e0e043e9342b0