Provide stable keys for components in lists
See https://preactjs.com/tutorial/08-keys/
This commit is contained in:
parent
980e0a1790
commit
85004ada3f
1 changed files with 10 additions and 6 deletions
|
|
@ -415,10 +415,11 @@
|
||||||
[:time.date {:datetime (:created_at post)} (first (str/split (:created_at post) "T"))]]]
|
[:time.date {:datetime (:created_at post)} (first (str/split (:created_at post) "T"))]]]
|
||||||
[:section.content {:dangerouslySetInnerHTML (r/unsafe-html (:content post))}]
|
[:section.content {:dangerouslySetInnerHTML (r/unsafe-html (:content post))}]
|
||||||
(when (seq (:media_attachments post))
|
(when (seq (:media_attachments post))
|
||||||
[:section.attachments
|
(into [:section.attachments]
|
||||||
(map-indexed (fn [idx item]
|
(map (fn [item]
|
||||||
^{:key idx} [attachment {:attachment item}])
|
(let [key (str "post-" (:id post) "-attachment-" (:id item))]
|
||||||
(:media_attachments post))])
|
^{:key key} [attachment {:attachment item}])))
|
||||||
|
(:media_attachments post)))
|
||||||
[:nav
|
[:nav
|
||||||
[:ul.controls
|
[:ul.controls
|
||||||
[:li.control-element.url
|
[:li.control-element.url
|
||||||
|
|
@ -519,8 +520,11 @@
|
||||||
[:section.buttons
|
[:section.buttons
|
||||||
[:button.control-button {:on-click fetch-more-posts! :disabled (boolean (seq loading))} "⇓ Fetch more"]
|
[:button.control-button {:on-click fetch-more-posts! :disabled (boolean (seq loading))} "⇓ Fetch more"]
|
||||||
[:button.control-button {:on-click disconnect-account!} "▤ Disconnect account"]]]
|
[:button.control-button {:on-click disconnect-account!} "▤ Disconnect account"]]]
|
||||||
[:ul.results (map-indexed (fn [idx p]
|
(into [:ul.results]
|
||||||
^{:key idx} [:li.result [post {:post p}]]) displayed-posts)]]))
|
(map (fn [p]
|
||||||
|
(let [key (str "post-" (:id p))]
|
||||||
|
^{:key key} [:li.result [post {:post p}]])))
|
||||||
|
displayed-posts)]))
|
||||||
|
|
||||||
;; help section
|
;; help section
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue