-
Notifications
You must be signed in to change notification settings - Fork 199
feat(type): allow optional for parameters of AbstractGraph.addCells #847
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
Conversation
The implementation provides default, so the types in the method signature have been adjusted accordingly. This matches the mxGraph behavior.
WalkthroughThe Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant CellsMixin
Caller->>CellsMixin: addCells(cells, parent?, index?, source?, target?, absolute?)
CellsMixin-->>Caller: Cell[]
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! ✨ 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: 0
🧹 Nitpick comments (2)
packages/core/src/view/mixins/CellsMixin.type.ts (2)
309-313: Keep event-name references consistent across docsGreat catch switching to
InternalEvent.ADD_CELLS.
Right below (lines 331-333) the doc forcellsAddedstill references{@link Event#CELLS_ADDED}. Consider updating that toInternalEvent.CELLS_ADDEDfor consistency with the new naming scheme.
315-318: Docs mentionnulldefaults, but the signature now also allowsundefinedBy marking the parameters optional (
?), TypeScript widens their type toCell | null | undefined/number | null | undefined.
If you want callers to prefernulloverundefined, add a short note such as “If omitted or explicitly set tonull, …”.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/core/src/view/mixins/CellsMixin.type.ts(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: build (ubuntu-22.04)
- GitHub Check: build (macos-14)
- GitHub Check: build
- GitHub Check: build (windows-2022)
🔇 Additional comments (1)
packages/core/src/view/mixins/CellsMixin.type.ts (1)
323-327: Verify whetheraddCellshould follow the same optional-parent pattern
addCellsnow correctly mirrors the implementation with an optionalparent.
addCell(lines 300-306) still requiresparent: Cell | null. If the runtime code also treats the parameter as optional, aligning the typings would avoid confusion:- parent: Cell | null, + parent?: Cell | null,Please double-check the implementation before applying.



The implementation provides default, so the types in the method signature have been adjusted accordingly.
This matches the mxGraph behavior.
Summary by CodeRabbit