{{ message }}
refactor: remove reference to legacy insert cells methods#876
Merged
tbouffard merged 3 commits intoJul 20, 2025
Conversation
These legacy methods have a large number of parameters, are hard to read and hard to evolve. So, to prepare the deprecation of these methods, use the new methods that take a single object parameter in code, examples and documentation. The storybook stories will be updated later. Also simplify some calls by not always setting the parent when it was set to the default parent (this is the default value, so no need to pass it in this case), nor setting an empty string value (same result as not setting it). In addition, apply various JSDoc improvements.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
packages/core/src/editor/Editor.ts (1)
286-294: Showcase the leaner call by omittingparentwhen it’s the default.Since the surrounding paragraph explains that the new API relieves the caller from passing the default parent, the example could be further simplified:
-const parent = editor.graph.getDefaultParent(); ... -editor.graph.insertVertex({parent, value: userObject, position: [20, 20], size: [80, 30]}); +editor.graph.insertVertex({value: userObject, position: [20, 20], size: [80, 30]});Not critical, but it keeps the documentation perfectly aligned with the stated goal of the refactor.
packages/website/docs/manual/cells.md (1)
112-120: Typo: replace “ommited” with “omitted”.- baseStyleNames: ['defaultVertex'], // This can be ommited, as it is the default style applied for vertices + baseStyleNames: ['defaultVertex'], // This can be omitted, as it is the default style applied for vertices
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




These legacy methods have a large number of parameters, are hard to read and hard to evolve.
So, to prepare the deprecation of these methods, use the new methods that take a single object parameter in code, examples and documentation.
The storybook stories will be updated later.
Also simplify some calls by not always setting the parent when it was set to the default parent (this is the default
value, so no need to pass it in this case), nor setting an empty string value (same result as not setting it).
In addition, apply various JSDoc improvements.
Notes
Covers #856
Summary by CodeRabbit
Documentation
insertVertexandinsertEdgemethods, replacing the previous positional argument approach.ignoreDefaultStyleflag.Refactor
Style