This commit is contained in:
Dan Holmsand 2015-08-31 10:59:59 +02:00
parent 6c345db29e
commit be7bb69548
2 changed files with 14 additions and 11 deletions

View File

@ -247,17 +247,19 @@
IComputedImpl IComputedImpl
(-handle-change [this sender oldval newval] (-handle-change [this sender oldval newval]
(when active? (when active?
(set! dirty? (max dirty? (let [old-dirty dirty?]
(if (identical? oldval newval) (set! dirty? (max dirty?
maybe-dirty is-dirty))) (if (identical? oldval newval)
(if auto-run maybe-dirty is-dirty)))
(do (if auto-run
;; FIXME: is this correct? (do
(binding [*ratom-context* this] ;; FIXME: is this correct?
(-check-clean this)) (when (== dirty? maybe-dirty)
(when (> dirty? clean) (binding [*ratom-context* (js-obj)]
((or auto-run run) this))) (-check-clean this)))
(-notify-watches this state state))) (when-not (== dirty? clean)
((or auto-run run) this)))
(-notify-watches this state state))))
;; (when (and active? (not (identical? oldval newval))) ;; (when (and active? (not (identical? oldval newval)))
;; (set! dirty? is-dirty) ;; (set! dirty? is-dirty)
;; ((or auto-run run) this)) ;; ((or auto-run run) this))

View File

@ -119,6 +119,7 @@
(reset! val 1) (reset! val 1)
(reset! val 2) (reset! val 2)
(reset! val 1) (reset! val 1)
(is (= 1 @ran))
(r/flush) (r/flush)
(is (found-in #"val 1" div)) (is (found-in #"val 1" div))
(is (= 2 @ran)) (is (= 2 @ran))