Remove helper for shouldComponentUpdate

This commit is contained in:
Dan Holmsand 2014-12-02 12:30:21 +01:00
parent a66de12cf5
commit 3c6d6cec1d
3 changed files with 6 additions and 11 deletions

View File

@ -29,8 +29,9 @@
(defn set-state [this new-state] (defn set-state [this new-state]
(swap! (state-atom this) merge new-state)) (swap! (state-atom this) merge new-state))
;; set from template, to avoid circular deps ;; ugly circular dependency
(def as-element nil) (defn as-element [x]
(reagent.impl.template/as-element x))
;;; Rendering ;;; Rendering
@ -92,7 +93,9 @@
(let [old-argv (.' c :props.argv) (let [old-argv (.' c :props.argv)
new-argv (.' nextprops :argv)] new-argv (.' nextprops :argv)]
(if (nil? f) (if (nil? f)
(not (util/equal-args old-argv new-argv)) (or (nil? old-argv)
(nil? new-argv)
(not= old-argv new-argv))
(f c old-argv new-argv)))))) (f c old-argv new-argv))))))
:componentWillUpdate :componentWillUpdate

View File

@ -230,9 +230,6 @@
(expand-seq x)) (expand-seq x))
true x)) true x))
;; Cheat, to avoid ugly circular dependency
(set! reagent.impl.component/as-element as-element)
(defn expand-seq [s] (defn expand-seq [s]
(let [a (into-array s)] (let [a (into-array s)]
(dotimes [i (alength a)] (dotimes [i (alength a)]

View File

@ -207,8 +207,3 @@
(partial-ifn. callback-fn args nil) (partial-ifn. callback-fn args nil)
false)) false))
;;; Helpers for shouldComponentUpdate
(defn equal-args [v1 v2]
(= v1 v2))