Fix bug in the new extract-children, and simplify wrapping

This commit is contained in:
Dan Holmsand 2014-02-09 08:48:55 +01:00
parent 3c2c63402e
commit e32c3ad044
2 changed files with 7 additions and 6 deletions

View File

@ -35,7 +35,8 @@
(if (map? p) p)))
(defn extract-children [v]
(let [first-child (if (-> v (get 1) map?) 2 1)]
(let [p (get v 1)
first-child (if (or (nil? p) (map? p)) 2 1)]
(if (> (count v) first-child)
(subvec v first-child))))

View File

@ -123,14 +123,14 @@
(defn wrapped-render [this comp id-class]
(let [inprops (aget this "props")
argv (aget inprops cljs-argv)
level (aget inprops cljs-level)
props (get argv 1)
hasprops (or (nil? props) (map? props))
first-child (if hasprops 2 1)
jsargs (if (> (count argv) first-child)
(map-into-array as-component (inc level)
(subvec argv first-child))
(array))
children (if (> (count argv) first-child)
(subvec argv first-child))
jsargs (map-into-array as-component
(inc (aget inprops cljs-level))
children)
jsprops (convert-props (if hasprops props) id-class)]
(when (input-components comp)
(input-render-setup this jsprops))