diff --git a/src/cloact/impl/component.cljs b/src/cloact/impl/component.cljs index faff984..b922fdd 100644 --- a/src/cloact/impl/component.cljs +++ b/src/cloact/impl/component.cljs @@ -103,7 +103,7 @@ (defn- do-render [C f] (set! (.-isRenderContext ratom/*ratom-context*) true) - (let [res (f (cljs-props C) f @C) + (let [res (f (cljs-props C) C @C) conv (if (vector? res) (tmpl/as-component res) (if (fn? res) @@ -141,12 +141,12 @@ :shouldComponentUpdate (fn [C nextprops nextstate] (assert (nil? f) "shouldComponentUpdate is not yet supported") - (assert (vector? (-> C .-props .-cljsArgs))) - (let [a1 (-> C .-props .-cljsArgs) + (let [a1 (args-of C) a2 (-> nextprops .-cljsArgs) ostate (.-cljsOldState C) - eq (and (tmpl/equal-args a1 a2) - (= ostate nextstate))] + eq (and (identical? ostate nextstate) + (tmpl/equal-args a1 a2))] + (assert (vector? a1)) (set! (.-cljsOldState C) nextstate) (not eq))) diff --git a/src/cloact/impl/template.cljs b/src/cloact/impl/template.cljs index 9640ccb..e424bb5 100644 --- a/src/cloact/impl/template.cljs +++ b/src/cloact/impl/template.cljs @@ -83,8 +83,8 @@ true (let [props1 (nth v1 1)] (if (or (nil? props1) (map? props1)) - (and (= props1 (nth v2 1)) - (identical-parts v1 v2 2)) + (and (identical-parts v1 v2 2) + (= props1 (nth v2 1))) (identical-parts v1 v2 1))))))) (declare wrapper) diff --git a/test/testcloact.cljs b/test/testcloact.cljs index f74e2a5..b8c2ad5 100644 --- a/test/testcloact.cljs +++ b/test/testcloact.cljs @@ -80,12 +80,6 @@ (swap! C assoc :foo "there") (is (found-in #"hi there" div)) - (let [runs @tests-run] - ;; should not be rendered - (swap! C assoc :foo "there") - (is (found-in #"hi there" div)) - (is (= runs @tests-run))) - (swap! C assoc :foo "you") (is (found-in #"hi you" div))))))