Fix shouldComponentUpdate calling

This commit is contained in:
Dan Holmsand 2013-12-17 19:37:32 +01:00
parent 662714a5e0
commit 00ac6d69f3
1 changed files with 10 additions and 4 deletions

View File

@ -47,7 +47,11 @@
(when-not -ToExtend (when-not -ToExtend
(.log js/console "this should never happen to " -ToExtend)) (.log js/console "this should never happen to " -ToExtend))
;;; Function wrapping ;;; Accessors
;; We store the "args" (i.e a vector like [comp props child1])
;; in .-cljsArgs, with optional args, which makes access a bit
;; tricky. The upside is that we don't have to do any allocations.
(defn- args-of [C] (defn- args-of [C]
(-> C .-props .-cljsArgs)) (-> C .-props .-cljsArgs))
@ -64,7 +68,7 @@
(if (or (nil? p) (map? p)) 2 1))) (if (or (nil? p) (map? p)) 2 1)))
(defn- cljs-props [C] (defn- cljs-props [C]
(-> (args-of C) props-in-args)) (-> C args-of props-in-args))
(defn- get-children [C] (defn- get-children [C]
(let [args (args-of C) (let [args (args-of C)
@ -129,7 +133,9 @@
(if (nil? f) (if (nil? f)
(not (and (identical? ostate nextstate) (not (and (identical? ostate nextstate)
(tmpl/equal-args a1 a2))) (tmpl/equal-args a1 a2)))
(f a1 a2 ostate nextstate)))) ;; Call f with oldprops, newprops, oldstate, newstate
(f (props-in-args a1) (props-in-args a2)
ostate nextstate))))
:componentWillUnmount :componentWillUnmount
(fn [C] (fn [C]
@ -183,7 +189,7 @@
(.-name r)))) (.-name r))))
name1 (if (empty? name) (str (gensym "cloact")) name)] name1 (if (empty? name) (str (gensym "cloact")) name)]
(into {} (for [[k v] (assoc fun-map :displayName name1)] (into {} (for [[k v] (assoc fun-map :displayName name1)]
[k (get-wrapper k v name)])))) [k (get-wrapper k v name1)]))))
(defn- add-atom-mixin (defn- add-atom-mixin
[props-map] [props-map]