-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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/1871 line color spill #3546
Conversation
Thank, this looks solid. I will go through it properley later this week! |
First of all! I had almost given up on that issue, (1871), so your PR is a gift, thank you! There are many ways of using Mermaid and many diagrams so it can be hard to notice issues. Fortunately we have our regression tests which tests the diagram by performing image comparisons. That stops many issues from slipping though and it found some things from your PR:
If you want to tests this locally you can do that:
I also suggest you merge in develop first as we have some e2e fixes in there since after your PR. |
Hey thanks for the great feedback @knsv! I will definitely try all the things you mentioned. I didn't catch these errors locally because I could not get a clean |
@dwhelan Are you still working on this PR? |
This PR appears to be abandoned, and the only unresolved issue at the time of writing this comment is #3433. There hasn't been much activity for a while, and I believe the number of conflicts will prevent anyone from continuing. I think this PR has served its purpose as a valuable reference, so we will close it after some time unless someone is willing to revive it. |
📑 Summary
Resolves #1871 and also resolves #3267, resolves #3433, resolves #1318, which had the same root cause.
The root cause of this bug is that marker ids are not unique. So, a marker url in a path element will select the first marker on the page.
📏 Design Decisions
The main decision was to create unique ids for markers by prefixing the marker name with the id of its parent SVG element. To make this consistent across drawings a
markers.ts
was added directly undersrc
. TheappendMarker(elem, name)
function is used to append a marker with a unique id and themarkerUrl(elem, name)
is used to reference the marker for a path. I updated all diagrams to use these new functions.I wanted to write unit tests but found it difficult when
d3
anddagre-d3
were mocked out. So I removed all mocks and updated vitest setup to require these as actual modules. I believe this is important as it allows us to now unit test against the DOM with d3. and dagre-d3.I am unsure of the purpose of
arrowMarkerAbsolute
. If it was introduced to avoid markerid
conflicts, then perhaps it could be removed.I added demo pages (
demos/1871-*.html
) to allow you to check out the fixes on diagrams. You can toggle the sourcevia html comments to see the changes vs v9.1.7:
I intend to delete the pages as part of this PR.
📋 Tasks
Make sure you
develop
branch