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"))]]]
|
||||
[:section.content {:dangerouslySetInnerHTML (r/unsafe-html (:content post))}]
|
||||
(when (seq (:media_attachments post))
|
||||
[:section.attachments
|
||||
(map-indexed (fn [idx item]
|
||||
^{:key idx} [attachment {:attachment item}])
|
||||
(:media_attachments post))])
|
||||
(into [:section.attachments]
|
||||
(map (fn [item]
|
||||
(let [key (str "post-" (:id post) "-attachment-" (:id item))]
|
||||
^{:key key} [attachment {:attachment item}])))
|
||||
(:media_attachments post)))
|
||||
[:nav
|
||||
[:ul.controls
|
||||
[:li.control-element.url
|
||||
|
|
@ -519,8 +520,11 @@
|
|||
[:section.buttons
|
||||
[:button.control-button {:on-click fetch-more-posts! :disabled (boolean (seq loading))} "⇓ Fetch more"]
|
||||
[:button.control-button {:on-click disconnect-account!} "▤ Disconnect account"]]]
|
||||
[:ul.results (map-indexed (fn [idx p]
|
||||
^{:key idx} [:li.result [post {:post p}]]) displayed-posts)]]))
|
||||
(into [:ul.results]
|
||||
(map (fn [p]
|
||||
(let [key (str "post-" (:id p))]
|
||||
^{:key key} [:li.result [post {:post p}]])))
|
||||
displayed-posts)]))
|
||||
|
||||
;; help section
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue