dweber019 / backstage-plugins

A collection of Backstage plugins
MIT License
20 stars 7 forks source link

endoflife: Fixed error for products that share the same cycles #14

Closed jwnmulder closed 4 months ago

jwnmulder commented 5 months ago

The EntityEndOfLifeCard will error when multiple products are listed that share the same cycle. As an example, adding the annotation 'endoflife.date/products': 'oracle-jdk,redhat-jboss-eap@7' will trigger that error on rendering the card.

Error log

Cannot add item: item with id 7 already exists
    at DataSet._addItem (webpack-internal:///../../node_modules/vis-timeline/standalone/esm/vis-timeline-graph2d.js:23660:15)
    at DataSet.add (webpack-internal:///../../node_modules/vis-timeline/standalone/esm/vis-timeline-graph2d.js:22979:21)
    at new DataSet (webpack-internal:///../../node_modules/vis-timeline/standalone/esm/vis-timeline-graph2d.js:22897:14)
    at Timeline.setGroups (webpack-internal:///../../node_modules/vis-timeline/standalone/esm/vis-timeline-graph2d.js:42822:46)
    at new Timeline (webpack-internal:///../../node_modules/vis-timeline/standalone/esm/vis-timeline-graph2d.js:42708:13)
    at eval (webpack-internal:///../../node_modules/@dweber019/backstage-plugin-endoflife/dist/esm/index-666b849a.esm.js:366:27)
    at eval (webpack-internal:///../../node_modules/@dweber019/backstage-plugin-endoflife/dist/esm/index-666b849a.esm.js:382:5)
    at commitHookEffectListMount (webpack-internal:///../../node_modules/react-dom/cjs/react-dom.development.js:23145:26)
    at commitPassiveMountOnFiber (webpack-internal:///../../node_modules/react-dom/cjs/react-dom.development.js:24921:13)
    at commitPassiveMountEffects_complete (webpack-internal:///../../node_modules/react-dom/cjs/react-dom.development.js:24886:9)

PR includes the fix and an accompanying test

dweber019 commented 5 months ago

Thanks for the contribution ❤️

Please provide a changeset file see https://github.com/dweber019/backstage-plugins/blob/main/CONTRIBUTING.md#how-to-create-a-changeset

Use patch