mirror of https://github.com/status-im/reagent.git
Work around clojurescript problem with sorted-maps
This commit is contained in:
parent
4ccec97274
commit
b77b182d67
|
@ -215,7 +215,11 @@
|
|||
(fn-to-class tag)))
|
||||
|
||||
(defn get-key [x]
|
||||
(when (map? x) (get x :key)))
|
||||
(when (map? x)
|
||||
;; try catch to avoid clojurescript peculiarity with
|
||||
;; sorted-maps with keys that are numbers
|
||||
(try (get x :key)
|
||||
(catch :default e))))
|
||||
|
||||
(defn key-from-vec [v]
|
||||
(if-some [k (some-> (meta v) get-key)]
|
||||
|
|
|
@ -552,3 +552,10 @@
|
|||
(fn [c]
|
||||
(is (seq @a))
|
||||
(is (re-find #"atestcomponent" @a) "component-path should work")))))
|
||||
|
||||
(deftest test-sorted-map-key
|
||||
(let [c1 (fn [map]
|
||||
[:div (map 1)])
|
||||
c2 (fn []
|
||||
[c1 (sorted-map 1 "foo" 2 "bar")])]
|
||||
(is (= (rstr [c2]) "<div>foo</div>"))))
|
||||
|
|
Loading…
Reference in New Issue