Skip to content

Commit

Permalink
[experiment] Fix duplicate keys
Browse files Browse the repository at this point in the history
we passed a seq of two seqs as :children to a v-table.
Reagent unpacks the seqs when it renders.
Between the two seqs, there are sometimes duplicate keys.

@hipitihop caught a warning for this, but I can't repro.

Wrapped each inner seq in its own v-table.
Ostensibly, this should prevent duplicate keys on child elements.

For #412
  • Loading branch information
kimo-k committed Feb 9, 2024
1 parent 1958ecd commit b15f915
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions src/day8/re_frame_10x/panels/subs/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -458,26 +458,30 @@
:style {:overflow-x "hidden"
:overflow-y "auto"}
:children
[(for [p all-subs]
^{:key (:id p)}
[pod (merge p
(get sub-expansions (:id p))
(get sub-pins (:id p)))])
[[rc/v-box
:children
(for [p all-subs]
^{:key (:id p)}
[pod (merge p
(get sub-expansions (:id p))
(get sub-pins (:id p)))])]
(when (seq intra-epoch-subs)
(list
^{:key "intra-epoch-line"}
[rc/line :size styles/gs-2s
:style {:margin "19px 0px"}]
^{:key "intra-epoch-title"}
[:h2 {:class "bm-heading-text"
:style {:margin "19px 0px"}}
[rc/hyperlink-href
:class (styles/hyperlink ambiance)
:href "https://github.com/day8/re-frame-10x/blob/master/docs/HyperlinkedInformation/IntraEpoch.md"
:label "Intra-Epoch Subscriptions"]]
(for [p intra-epoch-subs]
^{:key (:id p)}
[pod (merge p (get sub-expansions (:id p)))])))]]]]))
[rc/v-box
:children
(list
^{:key "intra-epoch-line"}
[rc/line :size styles/gs-2s
:style {:margin "19px 0px"}]
^{:key "intra-epoch-title"}
[:h2 {:class "bm-heading-text"
:style {:margin "19px 0px"}}
[rc/hyperlink-href
:class (styles/hyperlink ambiance)
:href "https://github.com/day8/re-frame-10x/blob/master/docs/HyperlinkedInformation/IntraEpoch.md"
:label "Intra-Epoch Subscriptions"]]
(for [p intra-epoch-subs]
^{:key (:id p)}
[pod (merge p (get sub-expansions (:id p)))]))])]]]]))

(defn filter-section []
[inputs/search
Expand Down

0 comments on commit b15f915

Please sign in to comment.