Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

FelixTJDietrich
Copy link
Contributor

Checklist

  • I documented the TypeScript code using JSDoc style.
  • I added multiple screenshots/screencasts of my UI changes
  • I translated all the newly inserted strings into German and English

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

@FelixTJDietrich FelixTJDietrich changed the title Fix SVG id collisions by using random UUIDs instead of element ID Fix SVG id collisions by using random UUIDs instead of element IDs Jul 12, 2024
@FelixTJDietrich FelixTJDietrich self-assigned this Jul 12, 2024
Copy link
Member

@farisd16 farisd16 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good to me, also tested and it worked as expected
Screenshot from 2024-07-22 10-15-29
Screenshot from 2024-07-22 10-15-25

@matthiaslehnertum
Copy link
Collaborator

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

@FelixTJDietrich
Copy link
Contributor Author

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.

@egenerse egenerse self-assigned this Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants