mirror of https://github.com/status-im/reagent.git
Avoid unnecessary warning about missing :key
:key is not necessary in seqs in render-to-string et al.
This commit is contained in:
parent
b2210c2bf3
commit
51048c7a7f
|
@ -282,7 +282,8 @@
|
|||
(warn "Reactive deref not supported in lazy seq, "
|
||||
"it should be wrapped in doall"
|
||||
(comp/comp-name) ". Value:\n" (pr-str x)))
|
||||
(when (.' ctx :no-key)
|
||||
(when (and (not comp/*non-reactive*)
|
||||
(.' ctx :no-key))
|
||||
(warn "Every element in a seq should have a unique "
|
||||
":key" (comp/comp-name) ". Value: " (pr-str x)))
|
||||
res))
|
||||
|
|
|
@ -516,3 +516,12 @@
|
|||
(rstr [:div.foo [:p.bar.foo [:b.foobar "xy"]]])))
|
||||
(is (= (rstr [:div>p.bar.foo>a.foobar {:href "href"} "xy"])
|
||||
(rstr [:div [:p.bar.foo [:a.foobar {:href "href"} "xy"]]]))))
|
||||
|
||||
|
||||
(deftest test-key-warning
|
||||
;; Just make sure that seq without key dont print unnecessary
|
||||
;; debug messages
|
||||
(r/render-to-static-markup [:div (for [x (range 5)]
|
||||
[:p x])])
|
||||
(r/render-to-string [:div (for [x (range 5)]
|
||||
[:p x])]))
|
||||
|
|
Loading…
Reference in New Issue