Use run instead of deref

This commit is contained in:
Dan Holmsand 2015-09-10 16:06:53 +02:00
parent 0634806104
commit 31b06375ef
1 changed files with 5 additions and 9 deletions

View File

@ -212,16 +212,14 @@
(set! ra.norun? true) (set! ra.norun? true)
(doseq [w ra.watching] (doseq [w ra.watching]
(when (and (reaction? w) (when (and (reaction? w)
(not (identical? (.-dirty? w) clean))) (not (== (.-dirty? w) clean)))
(-deref w))) (ra-check-clean w)
(when-not (== (.-dirty? w) clean)
(run w))))
(set! ra.norun? false) (set! ra.norun? false)
(when (== ra.dirty? maybe-dirty) (when (== ra.dirty? maybe-dirty)
(set! ra.dirty? clean)))) (set! ra.dirty? clean))))
(defn- ra-run-check [ra]
(binding [*ratom-context* (js-obj)]
(ra-check-clean ra)))
(defn- ra-handle-change [ra sender oldval newval] (defn- ra-handle-change [ra sender oldval newval]
(when ra.active? (when ra.active?
(let [old-dirty ra.dirty?] (let [old-dirty ra.dirty?]
@ -232,9 +230,7 @@
is-dirty))) is-dirty)))
(if (and ra.auto-run (not ra.norun?)) (if (and ra.auto-run (not ra.norun?))
(do (do
;; FIXME: is this correct? (ra-check-clean ra)
(when (== ra.dirty? maybe-dirty)
(ra-run-check ra))
(when-not (== ra.dirty? clean) (when-not (== ra.dirty? clean)
((or ra.auto-run run) ra))) ((or ra.auto-run run) ra)))
(when (== old-dirty clean) (when (== old-dirty clean)