ls1intum / Apollon

UML Modeling Editor written in React
https://apollon-library.readthedocs.io
MIT License
65 stars 22 forks source link

Fix SVG id collisions by using random UUIDs instead of element IDs #368

Open FelixTJDietrich opened 2 months ago

FelixTJDietrich commented 2 months ago

Checklist

Motivation and Context

In ls1intum/Artemis#8823 some markers are missing from the solution diagram.

References for this issue: https://stackoverflow.com/questions/37000385/multiple-svg-with-same-ids https://stackoverflow.com/questions/54349169/svg-marker-disappears-when-svg-with-identical-definition-is-hidden

Description

To prevent such id collisions on the same page in the future, I changed it to use a random UUID instead of the element.id.

Steps for Testing

Check if the <marker> elements have now a random uuid, by exporting multiple times.

Test Coverage

File Branch Line

no change

Screenshots

no change

matthiaslehnertum commented 1 month ago

@FelixTJDietrich Could you update the snapshots here so the tests go through?

FelixTJDietrich commented 1 month ago

I will update the code soon to use one global random uuid for the diagram if none is specified. I want to use a fixed id for the snaps so they become stable.