[Class Diagrams] Multiple comma-delimited generic types results in infinite recursion #4555
Labels
Status: Triage
Needs to be verified, categorized, etc
Type: Bug / Error
Something isn't working or is incorrect
Description
Attempting to use the generic type syntax with multiple comma-delimited types results in infinite recursion. Here are some examples of class diagrams that will cause this error:
The error produced in the console is:
Steps to reproduce
Screenshots
No response
Code Sample
Setup
Suggested Solutions
The error is in this function:
mermaid/packages/mermaid/src/diagrams/common/common.ts
Lines 180 to 197 in d9db2ed
There are multiple issues with this function.
parseGenericTypes
again with the same string (hence the infinite recursion).The solution for the infinite recursion would be to remove the recursive call on line 193, since that shouldn't be needed at all. However, that still would not address the issue of supporting comma-separated generic types as the output would still include tildes in the render.
The best solution by far would be to simply remove the tilde syntax altogether and add support for angle brackets instead:
Although this would be a breaking change, it would eliminate all possible ambiguities when pairing up the opening and closing braces.
Additional Context
No response
The text was updated successfully, but these errors were encountered: