-
Notifications
You must be signed in to change notification settings - Fork 199
refactor: remove reference to legacy insert cells methods #876
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
refactor: remove reference to legacy insert cells methods #876
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.
WalkthroughThis update refactors the usage of Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Graph
participant Model
User->>Graph: insertVertex({ value, position, size, ... })
Graph->>Model: add vertex with parameters from object
Model-->>Graph: vertex instance
Graph-->>User: created vertex
User->>Graph: insertEdge({ value, source, target, ... })
Graph->>Model: add edge with parameters from object
Model-->>Graph: edge instance
Graph-->>User: created edge
sequenceDiagram
participant Docs
participant Developer
Docs-->>Developer: Example: insertVertex({ value, position, size, style })
Docs-->>Developer: Example: insertEdge({ value, source, target, style })
Developer->>Graph: Uses new object-based API as per documentation
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
npm error Exit handler never called! 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
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
|



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