Skip to content

Commit

Permalink
chore(dev): react keys warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
xyhp915 committed Dec 31, 2024
1 parent 87906fb commit 91f3dc3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
22 changes: 12 additions & 10 deletions deps/shui/src/logseq/shui/shortcut/v1.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -62,26 +62,28 @@
"bg-transparent cursor-default active:bg-gray-03 hover:text-gray-11 opacity-80"))
:size size}
(for [[index tile] (map-indexed vector tiles)]
[:<>
(when (< 0 index)
[:span.ui__button__tile-separator])
[:span.ui__button__tile tile]]))))
[:span {:key index}
[:<>
(when (< 0 index)
[:span.ui__button__tile-separator])
[:span.ui__button__tile tile]]]))))

(rum/defc root
[shortcut & {:keys [size theme interactive?]
:or {size :xs
interactive? true
theme :gray}}]
:or {size :xs
interactive? true
theme :gray}}]
(when (seq shortcut)
(let [shortcuts (if (coll? shortcut)
[shortcut]
(parse-shortcuts shortcut))
opts {:interactive? interactive?}]
(for [[index binding] (map-indexed vector shortcuts)]
[:<>
[:span
{:key (str index)}
(when (< 0 index)
[:div.text-gray-11.text-sm {:key "sep"} "|"])
(if (coll? (first binding)) ; + included
[:span.text-gray-11.text-sm {:key "sep"} "|"])
(if (coll? (first binding)) ; + included
(for [[idx ks] (map-indexed vector binding)]
(rum/with-key
(part ks size opts)
Expand Down
2 changes: 1 addition & 1 deletion src/main/frontend/components/dnd.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
:else
(rum/with-key (sortable-item prop (:content item)) id))))
children' (if parent-node
[parent-node children]
[parent-node {:key "parent-node"} children]
children)]
(dnd-context
dnd-opts
Expand Down

0 comments on commit 91f3dc3

Please sign in to comment.