diff --git a/src/reagent/ratom.cljs b/src/reagent/ratom.cljs index 92a8131..5993387 100644 --- a/src/reagent/ratom.cljs +++ b/src/reagent/ratom.cljs @@ -240,7 +240,7 @@ IComputedImpl (-handle-change [this sender oldval newval] - (when (and active? (not dirty?) (not (identical? oldval newval))) + (when (and active? (not (identical? oldval newval))) (set! dirty? true) ((or auto-run run) this))) diff --git a/test/reagenttest/testcursor.cljs b/test/reagenttest/testcursor.cljs index 73f64bd..2afdc75 100644 --- a/test/reagenttest/testcursor.cljs +++ b/test/reagenttest/testcursor.cljs @@ -426,3 +426,19 @@ (swap! a update-in [:b] inc) (is (= 4 (swap! b inc))) (is (= 4 @b)))) + +(deftest test-double-reset + (let [a (r/atom {:foo {:active? false}}) + c (r/cursor a [:foo]) + f (fn [] + (swap! c assoc :not-pristine true) + (swap! a update-in [:foo :active?] not)) + spy (atom nil) + r (run! + (reset! spy (:active? @c)))] + (is (= @spy false)) + (f) + (is (= @spy true)) + (f) + (is (= @spy false)) + (dispose r)))