Fork me on GitHub

Clearly I’m doing something wrong, but reaction doesn’t seem to be working correctly for me.


The wrapped computation ends up much too eager to re-run.


If I write something like

(def example
    (let [name @tile-width]
      (log name))))
then the log gets called every time I deref example instead of every time tile-width changes.


An r/track also gets called every time I deref it, but r/track! works like I expect it to. For example

(defn example-fn! [] (log @tile-width))
(def example! (r/track! example-fn!))
(defn example-fn [] (log @tile-width))
(def example (r/track example-fn))


is anyone familiar with using cljsjs to pull in react-with-addons? I’m for some reason always getting instead of, despite a boot file as thus:

[reagent "0.6.0-alpha" :exclusions [cljsjs/react cljsjs/react-dom cljsjs/react-dom-server]]
                  ,,,[cljsjs/react-with-addons "15.1.0-0"]
                  ,,,[cljsjs/react-dom "15.1.0-0"]
                  ,,,[cljsjs/react-dom-server "15.1.0-0"]
those exclusions look correct to me, though? if I look at the reagent build process, it seems to require r-dom and r-dom/server via cljsjs packages but then provide its own react from a webpack build:
:dependencies [[org.clojure/clojure "1.8.0"]
                 [org.clojure/clojurescript "1.8.51"]
                 [cljsjs/react-dom "15.2.1-0"]
                 [cljsjs/react-dom-server "15.2.1-0”]]

            :webpack {:cljsbuild
                       {:builds {:client
                                   [{:file "target/webpack/bundle.js"
                                     :file-min "target/webpack/bundle.min.js"
                                     :provides ["cljsjs.react.dom"
                                     :requires []}]}}}}}


yet no matter what I do or which exclusions I list, I’m always getting not


Does anyone have any experience with using css animations and Reagent? I've got an element reacting to a r/atom called transforming? thusly: :transform (if @transforming? "scale(1,0)" "none"), and a different element changing the value of transforming? like this:

:on-change (fn [check-node] (let [flip-transforming? #(swap! transforming? not)
                                        toggled-check (get-checked check-node)]
                                    (reset! checkbox-state toggled-check)))
However, the reset! also causes a visual change to the same element that subscribes to the value of transforming?, and (I'm guessing) since flip-transforming? and the reset! occur right after one another and within the same "tick", the scale(1,0) never occurs.


I've tested with the reset commented out, and then, the animation appears correct.


How can I ensure that Reagent "waits" for css animations to finish?