GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: accept more nullish parameter in various methods by tbouffard · Pull Request #892 · maxGraph/maxGraph

Conversation

@tbouffard

@tbouffard tbouffard commented Jul 29, 2025 •
edited by coderabbitai Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

This prepares the migration of the "Wires" story to TypeScript.

Add a new factory method in CellMarker to override the CellHighlight instance
Export missing ConnectionHandlerCellMarker class

The signature of some methods of the following classes now accepts null and/or undefined because their implementation
already supported it:

  • CellMixin
  • ConnectionHandler
  • EdgeMixin
  • Geometry.setTerminalPoint
  • GraphView.updateFixedTerminalPoint
  • VertexMixin

Improve JSDoc in various locations.

Summary by CodeRabbit

  • New Features

    • Added a new export for ConnectionHandlerCellMarker and made ConnectionHandler available as a default export.
  • Documentation

    • Improved and clarified JSDoc comments across multiple classes and methods for better readability and accuracy.
  • Refactor

    • Updated method signatures to allow more flexibility with optional parameters in cell and edge creation methods.
    • Enhanced extensibility by introducing a protected hook for customizing cell highlighting behavior.
    • Allowed terminal points to be explicitly set to null for greater control.
  • Style

    • Improved code formatting and consistency in comments and parameter naming.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@tbouffard
feat: accept more nullish parameter in various methods
e73c6eb
This prepares the migration of the "Wires" story to TypeScript.

Add a new factory method in `CellMarker` to override the `CellHighlight` instance
Export missing `ConnectionHandlerCellMarker` class

The signature of some methods of the following classes now accepts null and/or undefined because their implementation
already supported it:
  - CellMixin
  - ConnectionHandler
  - EdgeMixin
  - Geometry.setTerminalPoint
  - GraphView.updateFixedTerminalPoint
  - VertexMixin

Improve JSDoc in various locations.
@tbouffard tbouffard added the enhancement New feature or request label Jul 29, 2025
@coderabbitai

coderabbitai Bot commented Jul 29, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Walkthrough

This change updates method signatures in various core graph classes and interfaces to make parameters optional, enhances export declarations for ConnectionHandler and its marker, and improves JSDoc comments and formatting throughout. No functional logic is altered; all changes focus on type flexibility, export structure, and documentation clarity.

Changes

Cohort / File(s) Change Summary
Export Additions
packages/core/src/index.ts
Adds a named export ConnectionHandlerCellMarker from ./view/plugins/ConnectionHandler.
GraphView Method Signature
packages/core/src/view/GraphView.ts
Updates updateFixedTerminalPoint method signature to accept `constraint: ConnectionConstraint
CellHighlight JSDoc
packages/core/src/view/cell/CellHighlight.ts
Updates JSDoc for highlight method to clarify references and event names; no logic changes.
CellMarker Construction Hook
packages/core/src/view/cell/CellMarker.ts
Refactors constructor to use a new protected createCellHighlight hook for CellHighlight instantiation, allowing subclass overrides.
Geometry Method Signature
packages/core/src/view/geometry/Geometry.ts
Updates setTerminalPoint to accept `point: Point
CellsMixin Type Optionality
packages/core/src/view/mixins/CellsMixin.type.ts
Makes the parent parameter of addCell optional in the AbstractGraph interface.
EdgeMixin Parameter Naming and Assertion
packages/core/src/view/mixins/EdgeMixin.ts
Renames parameters to underscore-prefixed names to indicate unused status and adds a non-null assertion to edge.setId(id!).
EdgeMixin Type Optionality
packages/core/src/view/mixins/EdgeMixin.type.ts
Makes parameters of insertEdge and createEdge optional in the AbstractGraph interface.
VertexMixin Parameter Optionality
packages/core/src/view/mixins/VertexMixin.ts
Makes _parent, id, and value parameters of createVertex optional and uses non-null assertion for vertex.setId(id!).
VertexMixin Type Optionality
packages/core/src/view/mixins/VertexMixin.type.ts
Makes parent, id, and value parameters of insertVertex and createVertex optional in the AbstractGraph interface.
ConnectionHandler Export and JSDoc
packages/core/src/view/plugins/ConnectionHandler.ts
Changes ConnectionHandler to a default exported class and ConnectionHandlerCellMarker to an exported class. Updates JSDoc comments for clarity, uses @link tags, documents default values, and applies minor formatting and code style improvements. No logic changes.
PanningHandler JSDoc
packages/core/src/view/plugins/PanningHandler.ts
Updates JSDoc for isPanningTrigger for clarity and style; no logic changes.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant AbstractGraph
    participant Cell
    participant Geometry

    User->>AbstractGraph: addCell(cell, [parent?], [index?], [source?], [target?])
    AbstractGraph->>Cell: (cell is created/modified)
    AbstractGraph->>Geometry: setTerminalPoint(point | null, isSource)
    Note right of AbstractGraph: All relevant parameters are now optional where applicable
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15–25 minutes

Possibly related PRs

  • maxGraph/maxGraph#847: Modifies method signatures in the AbstractGraph interface to make parameters optional, directly related to the optionality changes in this PR.
  • maxGraph/maxGraph#735: Refactors import/export paths and declarations for ConnectionHandler and related plugins, overlapping with this PR's export and declaration changes for ConnectionHandlerCellMarker.
  • maxGraph/maxGraph#876: Adds a named export ConnectionHandlerCellMarker and improves JSDoc comments in the same file, closely related to the export and documentation changes here.

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8e61895 and 2499230.

📒 Files selected for processing (3)
  • packages/core/src/view/mixins/EdgeMixin.ts (1 hunks)
  • packages/core/src/view/mixins/VertexMixin.ts (2 hunks)
  • packages/core/src/view/plugins/ConnectionHandler.ts (22 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/core/src/view/mixins/EdgeMixin.ts
  • packages/core/src/view/mixins/VertexMixin.ts
  • packages/core/src/view/plugins/ConnectionHandler.ts
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/accept_undefined_and_null_in_various_places

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.

❤️ Share
  • X
  • Mastodon
  • Reddit
  • LinkedIn
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

coderabbitai[bot]
coderabbitai Bot reviewed Jul 29, 2025
View reviewed changes

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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

🔭 Outside diff range comments (1)
packages/core/src/view/plugins/ConnectionHandler.ts (1)

1296-1313: Guard against undefined edgeState.style before mutation

updateEdgeState writes to this.edgeState.style.* without confirming the object exists.
A defensive guard avoids a rare but possible TypeError when style hasn’t been initialised:

-    if (this.sourceConstraint?.point) {
+    if (this.edgeState.style && this.sourceConstraint?.point) {
       this.edgeState.style.exitX = this.sourceConstraint.point.x;
       this.edgeState.style.exitY = this.sourceConstraint.point.y;
     }
 
-    if (constraint?.point) {
+    if (this.edgeState.style && constraint?.point) {
       this.edgeState.style.entryX = constraint.point.x;
       this.edgeState.style.entryY = constraint.point.y;
     } else if (this.edgeState.style) {
       this.edgeState.style.entryX = 0;
       this.edgeState.style.entryY = 0;
     }

This keeps the tight loop allocation-free and avoids undefined access.

♻️ Duplicate comments (1)
packages/core/src/view/mixins/VertexMixin.ts (1)

118-118: Same non-null assertion concern as in EdgeMixin.

The non-null assertion id! poses the same potential runtime risk as identified in EdgeMixin.ts line 259, where an optional id parameter is asserted as non-null.

🧹 Nitpick comments (2)
packages/core/src/view/GraphView.ts (1)

1129-1136: JSDoc still implies the argument is always a ConnectionConstraint

Since constraint can now be null, the doc-comment should reflect this to avoid confusion.

- * @param constraint {@link ConnectionConstraint} that specifies the connection.
+ * @param constraint {@link ConnectionConstraint} | null – optional connection constraint.
packages/core/src/view/plugins/ConnectionHandler.ts (1)

715-741: Remove TODO or add JSDoc for getIconPosition

There’s still a “TODO: Document me!” banner above getIconPosition. Either finish the JSDoc (preferred) or drop the TODO to avoid noise.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 95cdbc8 and e73c6eb.

📒 Files selected for processing (12)
  • packages/core/src/index.ts (1 hunks)
  • packages/core/src/view/GraphView.ts (1 hunks)
  • packages/core/src/view/cell/CellHighlight.ts (1 hunks)
  • packages/core/src/view/cell/CellMarker.ts (1 hunks)
  • packages/core/src/view/geometry/Geometry.ts (1 hunks)
  • packages/core/src/view/mixins/CellsMixin.type.ts (1 hunks)
  • packages/core/src/view/mixins/EdgeMixin.ts (1 hunks)
  • packages/core/src/view/mixins/EdgeMixin.type.ts (2 hunks)
  • packages/core/src/view/mixins/VertexMixin.ts (2 hunks)
  • packages/core/src/view/mixins/VertexMixin.type.ts (2 hunks)
  • packages/core/src/view/plugins/ConnectionHandler.ts (20 hunks)
  • packages/core/src/view/plugins/PanningHandler.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (9)
📓 Common learnings
Learnt from: tbouffard
PR: maxGraph/maxGraph#776
File: packages/core/src/view/AbstractGraph.ts:492-495
Timestamp: 2025-04-24T12:34:56.726Z
Learning: PR #776 focuses on refactoring to introduce AbstractGraph as a base class and moving code from Graph to AbstractGraph. Type improvements and other refinements should be addressed in future PRs to keep this one focused on the core architectural change.
Learnt from: tbouffard
PR: maxGraph/maxGraph#857
File: packages/core/src/view/plugins/SelectionHandler.ts:1081-1092
Timestamp: 2025-06-26T13:27:19.012Z
Learning: User tbouffard prefers to keep PRs focused on their main objective and defer implementation improvements or logic fixes to future dedicated PRs. For maxGraph, refactoring PRs like Dictionary→Map migration should not include unrelated logic improvements even when valid issues are identified in the migrated code.
Learnt from: tbouffard
PR: maxGraph/maxGraph#835
File: packages/html/stories/Orthogonal.stories.ts:114-117
Timestamp: 2025-05-26T12:34:54.318Z
Learning: The `null!` assertion pattern exists across multiple stories in the TypeScript migration and should be addressed systematically rather than in individual PRs.
Learnt from: tbouffard
PR: maxGraph/maxGraph#770
File: packages/core/src/view/cell/CellTracker.ts:99-101
Timestamp: 2025-04-18T07:02:31.931Z
Learning: In TypeScript, when implementing an interface, methods can have fewer parameters than declared in the interface due to TypeScript's structural typing system. Both omitting unused parameters entirely and prefixing them with underscore (e.g., _sender) are valid patterns in the maxGraph codebase.
Learnt from: tbouffard
PR: maxGraph/maxGraph#715
File: packages/html/stories/ZoomAndFit.stories.ts:0-0
Timestamp: 2025-03-14T06:01:22.326Z
Learning: For future improvements to the Graph component in maxGraph, tbouffard is interested in refactoring the `fit` method to use an object parameter pattern instead of multiple positional parameters, as the current approach makes the API harder to use when many parameters need to be specified with default values.
Learnt from: tbouffard
PR: maxGraph/maxGraph#593
File: .github/workflows/create-github-release.yml:42-42
Timestamp: 2025-01-28T16:22:25.804Z
Learning: In the GitHub release notes template for maxGraph, TODO comments are intentionally included to mark sections that must be reviewed by maintainers before publishing the release. These TODOs should not be removed or converted to validation steps as they are part of the release review process.
Learnt from: tbouffard
PR: maxGraph/maxGraph#791
File: packages/core/src/view/style/edge/Segment.ts:26-35
Timestamp: 2025-04-29T13:29:45.122Z
Learning: In the maxGraph project, JSDoc `{@link}` references to symbols don't need to be imported in the current file to work correctly. TypeDoc can resolve symbols across the entire project namespace, not just within the current file, which is common in modern documentation systems and IDEs.
Learnt from: tbouffard
PR: maxGraph/maxGraph#849
File: packages/html/stories/DragSource.stories.js:98-101
Timestamp: 2025-06-13T07:48:10.300Z
Learning: User tbouffard prefers answers in English; avoid switching to other languages in future replies.
packages/core/src/view/cell/CellMarker.ts (1)

Learnt from: tbouffard
PR: #776
File: packages/core/src/view/Graph.ts:85-92
Timestamp: 2025-04-24T12:34:10.366Z
Learning: The Graph class intentionally doesn't use collaborators (cellRenderer, selectionModel, view) from options in initializeCollaborators, as it's designed to replicate the previous implementation using only its factory methods for backward compatibility.

packages/core/src/view/GraphView.ts (2)

Learnt from: tbouffard
PR: #770
File: packages/core/src/view/cell/CellTracker.ts:99-101
Timestamp: 2025-04-18T07:02:31.931Z
Learning: In TypeScript, when implementing an interface, methods can have fewer parameters than declared in the interface due to TypeScript's structural typing system. Both omitting unused parameters entirely and prefixing them with underscore (e.g., _sender) are valid patterns in the maxGraph codebase.

Learnt from: tbouffard
PR: #776
File: packages/core/src/view/AbstractGraph.ts:492-495
Timestamp: 2025-04-24T12:34:56.726Z
Learning: PR #776 focuses on refactoring to introduce AbstractGraph as a base class and moving code from Graph to AbstractGraph. Type improvements and other refinements should be addressed in future PRs to keep this one focused on the core architectural change.

packages/core/src/view/mixins/CellsMixin.type.ts (1)

Learnt from: tbouffard
PR: #770
File: packages/core/src/view/cell/CellTracker.ts:99-101
Timestamp: 2025-04-18T07:02:31.931Z
Learning: In TypeScript, when implementing an interface, methods can have fewer parameters than declared in the interface due to TypeScript's structural typing system. Both omitting unused parameters entirely and prefixing them with underscore (e.g., _sender) are valid patterns in the maxGraph codebase.

packages/core/src/view/mixins/VertexMixin.ts (1)

Learnt from: tbouffard
PR: #770
File: packages/core/src/view/cell/CellTracker.ts:99-101
Timestamp: 2025-04-18T07:02:31.931Z
Learning: In TypeScript, when implementing an interface, methods can have fewer parameters than declared in the interface due to TypeScript's structural typing system. Both omitting unused parameters entirely and prefixing them with underscore (e.g., _sender) are valid patterns in the maxGraph codebase.

packages/core/src/view/mixins/EdgeMixin.type.ts (2)

Learnt from: tbouffard
PR: #770
File: packages/core/src/view/cell/CellTracker.ts:99-101
Timestamp: 2025-04-18T07:02:31.931Z
Learning: In TypeScript, when implementing an interface, methods can have fewer parameters than declared in the interface due to TypeScript's structural typing system. Both omitting unused parameters entirely and prefixing them with underscore (e.g., _sender) are valid patterns in the maxGraph codebase.

Learnt from: tbouffard
PR: #776
File: packages/core/src/view/AbstractGraph.ts:492-495
Timestamp: 2025-04-24T12:34:56.726Z
Learning: PR #776 focuses on refactoring to introduce AbstractGraph as a base class and moving code from Graph to AbstractGraph. Type improvements and other refinements should be addressed in future PRs to keep this one focused on the core architectural change.

packages/core/src/view/mixins/VertexMixin.type.ts (3)

Learnt from: tbouffard
PR: #770
File: packages/core/src/view/cell/CellTracker.ts:99-101
Timestamp: 2025-04-18T07:02:31.931Z
Learning: In TypeScript, when implementing an interface, methods can have fewer parameters than declared in the interface due to TypeScript's structural typing system. Both omitting unused parameters entirely and prefixing them with underscore (e.g., _sender) are valid patterns in the maxGraph codebase.

Learnt from: tbouffard
PR: #776
File: packages/core/src/view/AbstractGraph.ts:492-495
Timestamp: 2025-04-24T12:34:56.726Z
Learning: PR #776 focuses on refactoring to introduce AbstractGraph as a base class and moving code from Graph to AbstractGraph. Type improvements and other refinements should be addressed in future PRs to keep this one focused on the core architectural change.

Learnt from: tbouffard
PR: #776
File: packages/core/src/view/Graph.ts:85-92
Timestamp: 2025-04-24T12:34:10.366Z
Learning: The Graph class intentionally doesn't use collaborators (cellRenderer, selectionModel, view) from options in initializeCollaborators, as it's designed to replicate the previous implementation using only its factory methods for backward compatibility.

packages/core/src/view/mixins/EdgeMixin.ts (3)

Learnt from: tbouffard
PR: #770
File: packages/core/src/view/cell/CellTracker.ts:99-101
Timestamp: 2025-04-18T07:02:31.931Z
Learning: In TypeScript, when implementing an interface, methods can have fewer parameters than declared in the interface due to TypeScript's structural typing system. Both omitting unused parameters entirely and prefixing them with underscore (e.g., _sender) are valid patterns in the maxGraph codebase.

Learnt from: tbouffard
PR: #791
File: packages/website/docs/usage/edge-styles.md:59-63
Timestamp: 2025-04-29T13:30:18.686Z
Learning: In the EdgeStyles documentation, tbouffard prefers the existing text "A perimeter is a function matching the EdgeStyleFunction type" over suggestions that might create redundancy, even if terminology might be technically misaligned.

Learnt from: tbouffard
PR: #791
File: packages/website/docs/usage/edge-styles.md:59-63
Timestamp: 2025-04-29T13:32:14.572Z
Learning: In the EdgeStyles documentation, the sentence "A perimeter is a function matching the EdgeStyleFunction type" contains an incorrect term - "perimeter" should be replaced with "EdgeStyle" or "custom EdgeStyle" as the document is specifically about EdgeStyles.

packages/core/src/view/plugins/ConnectionHandler.ts (3)

Learnt from: tbouffard
PR: #791
File: packages/core/src/view/style/edge/Segment.ts:26-35
Timestamp: 2025-04-29T13:29:45.122Z
Learning: In the maxGraph project, JSDoc {@link} references to symbols don't need to be imported in the current file to work correctly. TypeDoc can resolve symbols across the entire project namespace, not just within the current file, which is common in modern documentation systems and IDEs.

Learnt from: tbouffard
PR: #776
File: packages/core/src/view/Graph.ts:85-92
Timestamp: 2025-04-24T12:34:10.366Z
Learning: The Graph class intentionally doesn't use collaborators (cellRenderer, selectionModel, view) from options in initializeCollaborators, as it's designed to replicate the previous implementation using only its factory methods for backward compatibility.

Learnt from: tbouffard
PR: #791
File: packages/website/docs/usage/edge-styles.md:59-63
Timestamp: 2025-04-29T13:30:18.686Z
Learning: In the EdgeStyles documentation, tbouffard prefers the existing text "A perimeter is a function matching the EdgeStyleFunction type" over suggestions that might create redundancy, even if terminology might be technically misaligned.

🧬 Code Graph Analysis (6)
packages/core/src/index.ts (3)
packages/html/stories/Anchors.stories.js (2)
  • MyCustomConnectionHandler (37-43)
  • createConnectionHandler (60-62)
packages/html/stories/FixedPoints.stories.js (2)
  • isConnectableCell (105-107)
  • MyCustomConnectionHandler (42-101)
packages/html/stories/Events.stories.js (1)
  • MyCustomConnectionHandler (40-43)
packages/core/src/view/plugins/PanningHandler.ts (1)
packages/core/src/view/event/InternalMouseEvent.ts (1)
  • isPopupTrigger (159-161)
packages/core/src/view/mixins/CellsMixin.type.ts (1)
packages/core/src/view/cell/Cell.ts (1)
  • Cell (66-888)
packages/core/src/view/mixins/VertexMixin.ts (1)
packages/core/src/view/cell/Cell.ts (1)
  • Cell (66-888)
packages/core/src/view/mixins/EdgeMixin.type.ts (2)
packages/core/src/view/cell/Cell.ts (1)
  • Cell (66-888)
packages/core/src/types.ts (1)
  • EdgeParametersValue (1066-1066)
packages/core/src/view/plugins/ConnectionHandler.ts (6)
packages/core/src/types.ts (2)
  • GraphPlugin (1179-1181)
  • MouseListenerSet (1211-1215)
packages/core/src/util/Constants.ts (3)
  • TOOLTIP_VERTICAL_OFFSET (75-75)
  • VALID_COLOR (150-150)
  • INVALID_COLOR (156-156)
packages/core/src/index.ts (1)
  • ConnectionHandlerCellMarker (52-52)
packages/html/stories/Anchors.stories.js (3)
  • MyCustomConnectionHandler (37-43)
  • createConnectionHandler (60-62)
  • MyCustomGraph (45-63)
packages/html/stories/FixedPoints.stories.js (2)
  • MyCustomConnectionHandler (42-101)
  • isConnectableCell (105-107)
packages/html/stories/Events.stories.js (2)
  • MyCustomConnectionHandler (40-43)
  • createConnectionHandler (56-58)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: build (windows-2022)
  • GitHub Check: build (macos-14)
  • GitHub Check: build (ubuntu-24.04)
  • GitHub Check: build
🔇 Additional comments (16)
packages/core/src/view/cell/CellHighlight.ts (1)

231-231: LGTM: Documentation fix improves accuracy.

The JSDoc comment correction properly references CellState and InternalEvent.MARK instead of the previous typos/incomplete references.

packages/core/src/view/plugins/PanningHandler.ts (1)

267-269: LGTM: Documentation formatting enhancement.

The JSDoc formatting improvements with inline code backticks and proper @link references enhance readability and IDE integration.

packages/core/src/index.ts (1)

52-52: Good addition: Improves API surface for connection handling.

Making ConnectionHandlerCellMarker available as a named export enables external customization of connection handling, which aligns with the usage patterns seen in the story files.

packages/core/src/view/cell/CellMarker.ts (1)

132-141: Excellent extensibility improvement using factory method pattern.

The introduction of the createCellHighlight factory method enables subclasses to customize the CellHighlight instance creation without overriding the entire constructor. This follows established patterns in the codebase for enabling extensibility.

packages/core/src/view/geometry/Geometry.ts (1)

195-195: Good type accuracy improvement.

Making the point parameter nullable (Point | null) accurately reflects the method's implementation and the nullable nature of the sourcePoint and targetPoint properties it sets. This enhances type safety and API flexibility.

packages/core/src/view/GraphView.ts (1)

1138-1146: Signature widening and cast removal look good

The parameter now explicitly allows null and the superfluous <Point> cast has been dropped. This aligns with the return type Point | null from getFixedTerminalPoint and with the PR’s intent to accept nullish values. No further action needed.

packages/core/src/view/mixins/CellsMixin.type.ts (1)

302-302: LGTM! Parameter made appropriately optional.

Making the parent parameter optional in the addCell method signature improves API flexibility while maintaining type safety. This change aligns well with the PR's objective of accepting more nullish parameters.

packages/core/src/view/mixins/EdgeMixin.ts (2)

250-255: LGTM! Unused parameters appropriately marked.

Prefixing unused parameters with underscores (_parent, _source, _target) follows TypeScript best practices and aligns with existing maxGraph patterns.


259-259: Verify id! assertion safety in EdgeMixin (and VertexMixin)

The non-null assertion (id!) may pass an actual undefined into setId at runtime. Automated searches didn’t locate the setId signature or its handling of undefined, so please manually confirm:

• Whether setId’s parameter is truly optional (e.g. id?: string) and
• How setId(undefined) behaves (auto-generates a new ID vs. assigns undefined)

If id can be undefined here, either guard the call or supply a default/generated ID before invoking:

packages/core/src/view/mixins/EdgeMixin.ts:259

-   edge.setId(id!); // the auto-generated id is done when adding the cell to the model
+   if (id != null) {
+     edge.setId(id);
+   }
+   // else rely on model to generate an ID when adding the cell

Repeat the same check in VertexMixin.ts.

packages/core/src/view/mixins/VertexMixin.ts (1)

101-103: LGTM! Parameters made appropriately optional.

Making the _parent, id, and value parameters optional aligns with the updated type signatures and improves API flexibility.

packages/core/src/view/mixins/EdgeMixin.type.ts (2)

186-192: LGTM! Method signature appropriately relaxed.

Making the parent, id, and value parameters optional in insertEdge improves API flexibility while maintaining type safety. The changes are well-coordinated with the implementation.


216-222: LGTM! Consistent parameter flexibility for createEdge.

The optional parameters in createEdge align well with the implementation changes and provide consistent API flexibility across edge creation methods.

packages/core/src/view/mixins/VertexMixin.type.ts (2)

92-102: LGTM! Consistent API flexibility for insertVertex.

Making the parent, id, and value parameters optional maintains consistency with the edge methods and provides the same flexible API experience across vertex operations.


165-175: LGTM! Well-coordinated createVertex signature.

The optional parameters in createVertex complete the consistent pattern across all cell creation methods, maintaining type safety while improving API flexibility.

packages/core/src/view/plugins/ConnectionHandler.ts (2)

205-208: Verify export strategy – default vs named

The class is now declared with export default, while packages/core/src/index.ts appears to re-export ConnectionHandler as a named export.
Having both export default and a re-exported name is fine, but please double-check that:

  1. The index file does not add a second export default (rollup/tsc will complain).
  2. External consumers keep using a single, canonical import style to avoid duplication in bundle output.

No change requested if the build remains clean; this is a heads-up.


2014-2029: 👍 Good call on exporting ConnectionHandlerCellMarker

Promoting the marker to a public export solves long-standing extension friction and aligns with storybook examples that subclass it.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@tbouffard
Fix import
8e61895
@tbouffard tbouffard mentioned this pull request Jul 29, 2025
refactor: fix most problems in the Wires story #893
Merged
tbouffard added 2 commits July 30, 2025 09:20
@tbouffard
create cell: improve comment [skip ci]
26b847c
@tbouffard
ConnectionHandler: improve JSDoc [skip ci]
2499230
@sonarqubecloud

sonarqubecloud Bot commented Jul 30, 2025

Copy link
Copy Markdown

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tbouffard
tbouffard merged commit 74e44bc into main Jul 30, 2025
@tbouffard
tbouffard deleted the feat/accept_undefined_and_null_in_various_places branch July 30, 2025 08:31
@coderabbitai coderabbitai Bot mentioned this pull request Aug 28, 2025
refactor: migrate the Guides story to TypeScript #908
Merged
@coderabbitai coderabbitai Bot mentioned this pull request Sep 24, 2025
chore(typescript): always use explicit override #921
Merged
@coderabbitai coderabbitai Bot mentioned this pull request Dec 23, 2025
refactor: use singular and kebab-case for source folder names #985
Merged
@coderabbitai coderabbitai Bot mentioned this pull request Mar 25, 2026
fix: restore preview edge default target position on cell hover #1025
Merged
7 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@coderabbitai coderabbitai[bot] coderabbitai[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

enhancement New feature or request

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@tbouffard
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.