mirror of https://github.com/status-im/reagent.git
Fix bug in the new extract-children, and simplify wrapping
This commit is contained in:
parent
3c2c63402e
commit
e32c3ad044
|
@ -35,7 +35,8 @@
|
||||||
(if (map? p) p)))
|
(if (map? p) p)))
|
||||||
|
|
||||||
(defn extract-children [v]
|
(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)
|
(if (> (count v) first-child)
|
||||||
(subvec v first-child))))
|
(subvec v first-child))))
|
||||||
|
|
||||||
|
|
|
@ -123,14 +123,14 @@
|
||||||
(defn wrapped-render [this comp id-class]
|
(defn wrapped-render [this comp id-class]
|
||||||
(let [inprops (aget this "props")
|
(let [inprops (aget this "props")
|
||||||
argv (aget inprops cljs-argv)
|
argv (aget inprops cljs-argv)
|
||||||
level (aget inprops cljs-level)
|
|
||||||
props (get argv 1)
|
props (get argv 1)
|
||||||
hasprops (or (nil? props) (map? props))
|
hasprops (or (nil? props) (map? props))
|
||||||
first-child (if hasprops 2 1)
|
first-child (if hasprops 2 1)
|
||||||
jsargs (if (> (count argv) first-child)
|
children (if (> (count argv) first-child)
|
||||||
(map-into-array as-component (inc level)
|
|
||||||
(subvec argv first-child))
|
(subvec argv first-child))
|
||||||
(array))
|
jsargs (map-into-array as-component
|
||||||
|
(inc (aget inprops cljs-level))
|
||||||
|
children)
|
||||||
jsprops (convert-props (if hasprops props) id-class)]
|
jsprops (convert-props (if hasprops props) id-class)]
|
||||||
(when (input-components comp)
|
(when (input-components comp)
|
||||||
(input-render-setup this jsprops))
|
(input-render-setup this jsprops))
|
||||||
|
|
Loading…
Reference in New Issue