diff --git a/project.clj b/project.clj index 2c78928..b73eca9 100644 --- a/project.clj +++ b/project.clj @@ -47,7 +47,7 @@ {:compiler {:optimizations :advanced :elide-asserts true :pretty-print false - ;; :pseudo-names true + :pseudo-names true :output-dir "target/client"}}}}}] :prod-test [:test :prod] diff --git a/src/reagent/ratom.cljs b/src/reagent/ratom.cljs index 8e022d5..463fac1 100644 --- a/src/reagent/ratom.cljs +++ b/src/reagent/ratom.cljs @@ -295,34 +295,29 @@ IRunnable (run [this] - (set! norun? true) (let [oldstate state res (capture-derefed f this) derefed (captured this)] (when (not= derefed watching) (-update-watching this derefed)) - (set! norun? false) (set! dirtyness clean) - (set! state res) - (-notify-watches this oldstate state) + (-notify-watches this oldstate (set! state res)) res)) IDeref (-deref [this] (-check-clean this) - (if (or (some? auto-run) (some? *ratom-context*)) + (if (and (nil? auto-run) (nil? *ratom-context*)) + (when-not (== dirtyness clean) + (let [oldstate state + newstate (f)] + (when-not (identical? oldstate newstate) + (-notify-watches this oldstate (set! state newstate))))) (do (notify-deref-watcher! this) - (if-not (== dirtyness clean) - (run this) - state)) - (do (when-not (== dirtyness clean) - (let [oldstate state] - (set! state (f)) - (when-not (identical? oldstate state) - (-notify-watches this oldstate state)))) - state))) + (run this)))) + state) IDisposable (dispose! [this] diff --git a/test/reagenttest/testratom.cljs b/test/reagenttest/testratom.cljs index 792c1aa..1f983b2 100644 --- a/test/reagenttest/testratom.cljs +++ b/test/reagenttest/testratom.cljs @@ -16,6 +16,7 @@ (def perf-check 0) (defn ratom-perf [] (dbg "ratom-perf") + (set! rv/debug false) (set! perf-check 0) (let [nite 100000 a (rv/atom 0)