1
0
Эх сурвалжийг харах

enhance(rum): adapt react class for the component friendly keys warning

charlie 10 сар өмнө
parent
commit
4bcda99145

+ 9 - 3
deps/shui/src/logseq/shui/util.cljs

@@ -60,11 +60,17 @@
                           [(first args) (rest args)]
                           [{} args])
         type# (first children)
+        children# (daiquiri.interpreter/interpret children)
+        children# (if (= 1 (count children#)) (first children#) children#)
         ;; we have to make sure to check if the children is sequential
         ;; as a list can be returned, eg: from a (for)
-        new-children (if (sequential? type#)
-                       [(daiquiri.interpreter/interpret children)]
-                       (daiquiri.interpreter/interpret children))
+        new-children (if (and (not (nil? children#))
+                           (not (empty? children))
+                           (or (not (array? children#))
+                             ;; maybe list children
+                             (not (vector? type#))))
+                       [children#] children#)
+
         ;; convert any options key value to a React element, if
         ;; a valid html element tag is used, using sablono (rum.daiquiri)
         vector->react-elems (fn [[key val]]