-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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/1294_exhaustive-clear-sequenceDb-variables #4941
fix/1294_exhaustive-clear-sequenceDb-variables #4941
Conversation
✅ Deploy Preview for mermaid-js ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## develop #4941 +/- ##
============================================
+ Coverage 43.04% 79.70% +36.65%
============================================
Files 23 167 +144
Lines 5018 13873 +8855
Branches 21 707 +686
============================================
+ Hits 2160 11057 +8897
+ Misses 2857 2663 -194
- Partials 1 153 +152
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is splendid, and long overdue!
@Yokozuna59 has been doing related work in other diagrams, so their review would be good to have.
Few minor issues only, great job!
…ram.md Co-authored-by: Sidharth Vinod <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks awesome :)
I love how you've managed to change the code in a way that should prevent a bug like #1294 from happening again too!
The only thing I don't 100% love is the syntax, which is a bit unusual to me. I feel like using something like the following would more closely match the rest of the JavaScript eco-system:
state = new ImperativeState(() => {
// default state
});
I've already even got a commit for it: aloisklink@35191a6 that I could push to this branch.
@rflban can you integrate the suggestions and update the PR? Would love to merge this soon. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love this PR. My general thoughts about DB is that instead of "cleaning" function we have to recreate DB as an object, so our overall flow would be
- create db
- populate it with data from parser
- render it
Every call of "clean" basically equals object destruction. So I love the overall approach and I think it have to be pushed further than that.
I agree on the comments from other reviewers, it's better to address them. Lets wait for those minor fixes, and this is good to go. Just comment from me this time, not approve, neither reject.
@rflban Do you have time to address the review comments, or can we push the changes and merge it? Would like to include this in the next release. |
Sorry, I haven't notice the new comments. I will fix the comments today |
@rflban sorry to bother you. This is an excellent candidate for what might be the last v10 release (which we're hoping to do by next week). Otherwise we would've moved it out of the queue. |
It's my fault, I did not have time to commit changes. But this pr is ready to check now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Thanks for making those changes!
@sidharthv96, do you want to double-check that all of your "Requested changes" have been dealt with before merging this PR? GitHub is blocking me from merging until all conversations have been resolved.
* develop: (200 commits) chore(deps): update all minor dependencies adds corresponding change in docs/ecosystem Adds Unison programming language to community integrations list Fixed parser/tests Update docs Update classDiagram.md Update classDiagram.md Update docs Update packages/mermaid/src/diagrams/class/classDb.ts Update packages/mermaid/src/docs/syntax/classDiagram.md Update packages/mermaid/src/diagrams/class/classDb.ts chore(deps): update all minor dependencies Update generics docs Update docs Address potential undefined refactor: Move maxEdges out of flowchart config. refactor: Move maxEdges out of flowchart config. chore: Add maxEdges to secure list Update docs Update NiceGuy.io links in integrations-community.md ...
@rflban, Thank you for the contribution! |
📑 Summary
Reason of bugs like one in issue are global variables cached between renders. I've made exhaustive cleanup of sequenceDb.
You can reproduce the bug in mermaid live editor with these diagrams:
Resolves #1294
📏 Design Decisions
I've added imperative state. It's simple structure, that is created from init function and provides reset method, that recalls init function to restore initial values of state's fields. This approach ensures that newly added state fields are cleared.
Also I've added two identity functions, that help specify type of state initial values for typescript.
📋 Tasks
Make sure you
MERMAID_RELEASE_VERSION
is used for all new features.develop
branch