Skip to content

Conversation

@tbouffard
Copy link
Member

@tbouffard tbouffard commented Aug 28, 2025

Improve types in method signatures for clarity, and simplify implementation (default values and for loop).
Also improve JSDoc

Summary by CodeRabbit

  • Documentation

    • Clarified property descriptions, added @default annotations, updated examples to use current event names, and corrected wording/grammar.
  • Refactor

    • Improved type safety and internal lookup structures in edge-layout logic; one method now returns a keyed mapping and another may return null (refined API contract).
  • Style

    • Minor formatting and wording tweaks in docs and examples.

Note: No runtime behavior changes for end users.

@tbouffard tbouffard added the documentation Improvements or additions to documentation label Aug 28, 2025
@coderabbitai
Copy link

coderabbitai bot commented Aug 28, 2025

Walkthrough

Typed and behavioral-tightening updates to ParallelEdgeLayout: findParallels now returns Record<string, Cell[]>, getEdgeId returns string | null, equality checks tightened, null/undefined checks use isNullish, iteration and lookup initialization refactored, and documentation/examples adjusted; core layout behavior unchanged.

Changes

Cohort / File(s) Summary
Core layout internals
packages/core/src/view/layout/ParallelEdgeLayout.ts
Change findParallels return type to Record<string, Cell[]>; getEdgeId now returns `string

Sequence Diagram(s)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested labels

documentation

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch docs/parrallelEdgeLayout_jsdoc_improvements

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
🪧 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.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbit in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbit 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:
    • @coderabbit gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbit read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbit help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbit ignore or @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbit summary or @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbit or @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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.

Copy link

@coderabbitai coderabbitai bot left a 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 (5)
packages/core/src/view/layout/ParallelEdgeLayout.ts (5)

38-58: Use strict equality in the JS example.

Small tweak for best practice and to avoid accidental type coercion in examples.

- *     return !(model.isEdge(edge2) && ((src == src2 && trg == trg2) || (src == trg2 && trg == src2)));
+ *     return !(model.isEdge(edge2) && ((src === src2 && trg === trg2) || (src === trg2 && trg === src2)));

74-77: Minor grammar and tag consistency.

Use “whether” and align with @DefaultValue.

-   * Specifies if only overlapping edges should be considered parallel.
-   * @default false
+   * Specifies whether only overlapping edges should be considered parallel.
+   * @defaultValue false

100-100: Guard against prototype pollution in lookup map.

Using a plain object is fine, but Object.create(null) avoids inherited keys. Also prefer the shorter Cell[] syntax.

-    const lookup: Record<string, Array<Cell>> = {};
+    const lookup: Record<string, Cell[]> = Object.create(null);

Optionally, iterate without for..in (outside this hunk):

for (const [id, parallels] of Object.entries(lookup)) {
  if (parallels.length > 1) this.layout(parallels);
}

133-135: Tighten wording: pluralize “terminals” and capitalize “ID”.

Small doc polish.

-   * Returns a unique ID for the given edge.
-   * The id is independent of the edge direction and is built using the visible terminal of the given edge.
+   * Returns a unique ID for the given edge.
+   * The ID is independent of the edge direction and is built using the visible terminals of the given edge.

Also, minor grammar fix in the method body comment (outside this hunk):

// Cannot use cached visible terminal because this could be triggered in BEFORE_UNDO

68-71: Retain @default tag and clarify units. Update only the description to “Defines the spacing between parallel edges (in pixels).” and keep @default 20 to match the repo’s existing JSDoc convention.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 336d4a6 and daeacfd.

📒 Files selected for processing (1)
  • packages/core/src/view/layout/ParallelEdgeLayout.ts (5 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
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.
⏰ 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
  • GitHub Check: build (ubuntu-24.04)
  • GitHub Check: build (windows-2022)
  • GitHub Check: build (macos-14)
🔇 Additional comments (1)
packages/core/src/view/layout/ParallelEdgeLayout.ts (1)

27-30: Doc intro improvements look good.

Accurate summary and clearer scoping for parallel edges.

Copy link

@coderabbitai coderabbitai bot left a 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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/core/src/view/layout/ParallelEdgeLayout.ts (1)

139-139: Fix grammar in comment.

-    // Cannot used cached visible terminal because this could be triggered in BEFORE_UNDO
+    // Cannot use cached visible terminal because this could be triggered in BEFORE_UNDO
🧹 Nitpick comments (4)
packages/core/src/view/layout/ParallelEdgeLayout.ts (4)

38-38: Example preface: tiny polish.

Consider adding an inline note that InternalEvent must be imported in the example to avoid confusion for readers integrating it.


43-55: Align example with runtime: use visible terminals like getEdgeId does.

findParallels/getEdgeId use view.getVisibleTerminal; the example filters with model.getTerminal, which can diverge when terminals aren’t visible. Suggest this doc tweak for consistency.

-graph.addListener(InternalEvent.CELL_CONNECTED, (sender, evt) => {
+graph.addListener(InternalEvent.CELL_CONNECTED, (sender, evt) => {
   const model = graph.getDataModel();
+  const view = graph.getView();
   const edge = evt.getProperty('edge');
-  const src = model.getTerminal(edge, true);
-  const trg = model.getTerminal(edge, false);
+  const src = view.getVisibleTerminal(edge, true);
+  const trg = view.getVisibleTerminal(edge, false);

   layout.isEdgeIgnored = (edge2) => {
-    const src2 = model.getTerminal(edge2, true);
-    const trg2 = model.getTerminal(edge2, false);
+    const src2 = view.getVisibleTerminal(edge2, true);
+    const trg2 = view.getVisibleTerminal(edge2, false);

     return !(model.isEdge(edge2) && ((src === src2 && trg === trg2) || (src === trg2 && trg === src2)));
   };

99-129: Typed return is good; tighten dictionary usage and iteration.

Minor safety/readability tweaks:

  • Use a null-prototype object to avoid inherited enumerable keys.
  • Use nullish coalescing assignment when populating.
  • Iterate with Object.values to avoid for..in pitfalls.
-findParallels(parent: Cell, cells: Cell[] | null = null): Record<string, Cell[]> {
-  const lookup: Record<string, Cell[]> = {};
+findParallels(parent: Cell, cells: Cell[] | null = null): Record<string, Cell[]> {
+  const lookup = Object.create(null) as Record<string, Cell[]>;-        if (id != null) {
-          if (lookup[id] == null) {
-            lookup[id] = [];
-          }
-
-          lookup[id].push(cell);
-        }
+        if (id != null) {
+          (lookup[id] ??= []).push(cell);
+        }

And in execute:

-    this.graph.batchUpdate(() => {
-      for (const i in lookup) {
-        const parallels = lookup[i];
-
-        if (parallels.length > 1) {
-          this.layout(parallels);
-        }
-      }
-    });
+    this.graph.batchUpdate(() => {
+      for (const parallels of Object.values(lookup)) {
+        if (parallels.length > 1) this.layout(parallels);
+      }
+    });

133-135: Doc wording improvement is accurate. Add explicit return type to the method.

getEdgeId returns string | null; make it explicit for public API clarity.

-  getEdgeId(edge: Cell) {
+  getEdgeId(edge: Cell): string | null {
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between daeacfd and 40914ff.

📒 Files selected for processing (1)
  • packages/core/src/view/layout/ParallelEdgeLayout.ts (5 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
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.
🧬 Code graph analysis (1)
packages/core/src/view/layout/ParallelEdgeLayout.ts (1)
packages/core/src/view/cell/Cell.ts (1)
  • Cell (66-888)
⏰ 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 (ubuntu-24.04)
  • GitHub Check: build (macos-14)
  • GitHub Check: build
🔇 Additional comments (3)
packages/core/src/view/layout/ParallelEdgeLayout.ts (3)

27-30: JSDoc scope clarification reads well.

The updated class-level description improves clarity without altering semantics.


68-71: @default annotations: good addition.

Explicit defaults help TS/IDE tooling.


74-77: @default annotations: good addition (checkOverlap).

Docs now accurately reflect the runtime default.

@tbouffard tbouffard added refactor Code refactoring and removed documentation Improvements or additions to documentation labels Aug 28, 2025
@tbouffard tbouffard changed the title docs: improve the JSDoc of ParallelEdgeLayout refactor: simplify implementation of ParallelEdgeLayout Aug 28, 2025
Copy link

@coderabbitai coderabbitai bot left a 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/view/layout/ParallelEdgeLayout.ts (2)

39-56: Example: switch to InternalEvent and strict equality is good; consider showing the import

To avoid confusion for readers, add the import in the snippet, e.g., import { InternalEvent } from '@maxgraph/core';.


134-134: Nit: use local view consistently

Minor consistency polish; no behavior change.

-        const state = this.graph.view.getState(edge);
+        const state = view.getState(edge);
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 40914ff and 7d5cd02.

📒 Files selected for processing (1)
  • packages/core/src/view/layout/ParallelEdgeLayout.ts (6 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
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#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#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.
🧬 Code graph analysis (1)
packages/core/src/view/layout/ParallelEdgeLayout.ts (1)
packages/core/src/internal/utils.ts (1)
  • isNullish (44-45)
⏰ 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
  • GitHub Check: build (windows-2022)
  • GitHub Check: build (macos-14)
  • GitHub Check: build (ubuntu-24.04)
🔇 Additional comments (8)
packages/core/src/view/layout/ParallelEdgeLayout.ts (8)

25-25: LGTM: dedicated nullish check import

Import is correct and used appropriately. Keeping scope in mind, no further change needed.


28-31: Docs clarity improved

More precise description; no functional impact.


69-71: Good: @default for spacing

Matches implementation.


75-77: Good: @default for checkOverlap

Docs match behavior.


111-114: Truthiness check simplification is fine

[] is truthy; behavior preserved.


98-101: No findParallels overrides detected; signature change safe
Typed return and null-prototype lookup are appropriate, and no subclasses override findParallels in the codebase.


128-132: No external getEdgeId callers; null is already handled Internal search shows only the self-call at line 103, which is guarded by isNullish(id). No downstream code assumes a non-nullable string.


87-87: Iteration via Object.values is cleaner. packages/core inherits from the root tsconfig (target ES2020, lib ES2020), so compile-time support for Object.values is already present; ensure your runtime supports ES2017 features or include a polyfill.

Comment on lines +105 to 107
if (!isNullish(id)) {
(lookup[id] ??= []).push(cell);
}
Copy link

@coderabbitai coderabbitai bot Aug 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Nullish coalescing assignment (??=) may require ES2021 target

If build target < ES2021, replace with an older-safe pattern.

Check precedent and tsconfig:

Fallback change if needed:

-          (lookup[id] ??= []).push(cell);
+          const bucket = lookup[id] || (lookup[id] = []);
+          bucket.push(cell);

🏁 Script executed:

#!/bin/bash
rg -nF '??=' --glob '!**/node_modules/**'
rg -n --glob '!**/node_modules/**' -S '\b"target"\s*:\s*"ES' tsconfig*.json packages/**/tsconfig*.json

Length of output: 1108


🏁 Script executed:

#!/bin/bash
rg -n '"target"' --glob 'tsconfig*.json' tsconfig.json packages/**/tsconfig*.json

Length of output: 501


Nullish coalescing assignment (??=) requires ES2021
Our root tsconfig.json and several package configs target ES2020 (and ES2015 in ts-support), so ??= will be emitted unchanged and isn’t supported at runtime. Either bump "target" to "ES2021" in tsconfig.json (and package configs) or replace this line with a safe pattern:

-          (lookup[id] ??= []).push(cell);
+          const bucket = lookup[id] || (lookup[id] = []);
+          bucket.push(cell);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (!isNullish(id)) {
(lookup[id] ??= []).push(cell);
}
if (!isNullish(id)) {
const bucket = lookup[id] || (lookup[id] = []);
bucket.push(cell);
}
🤖 Prompt for AI Agents
In packages/core/src/view/layout/ParallelEdgeLayout.ts around lines 105-107, the
use of the nullish coalescing assignment operator (??=) is not supported by our
ES2020 runtime; either update the project tsconfig targets to ES2021 (and
package configs) so ??= is emitted safely, or replace the expression with an
explicit initialization: check whether lookup[id] is present and if not assign
an empty array, then push the cell; ensure the null check for id remains
unchanged.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a problem with the current TS code.
TypeScript generates the following JS code which is compatible with ES2020 (this is the target version).

 (lookup[id] ?? (lookup[id] = [])).push(cell);

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tbouffard Thank you for the clarification! You're absolutely correct, and I apologize for the confusion in my analysis.

I failed to consider that TypeScript automatically transpiles the nullish coalescing assignment operator (??=) to ES2020-compatible code. As you've shown, the TypeScript compiler generates (lookup[id] ?? (lookup[id] = [])), which uses the nullish coalescing operator (??) that is indeed supported in ES2020, combined with standard assignment.

The original code using (lookup[id] ??= []).push(cell) is perfectly fine and doesn't require any changes. TypeScript handles the transpilation seamlessly while preserving the exact same runtime behavior.

  (\   /)
 ( ._.)
o_(")(")

learned something new


🔥 Failed to add learnings

Learnings cannot be added due to server error. Please try again.


🧠 Learnings used
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.

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#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.

@sonarqubecloud
Copy link

Copy link

@coderabbitai coderabbitai bot left a 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 (1)
packages/core/src/view/layout/ParallelEdgeLayout.ts (1)

134-160: Remove type assertions in getEdgeId by narrowing once

Avoids repeated <string> casts and tightens types locally.

Apply:

-    let src: Cell | string | null = view.getVisibleTerminal(edge, true);
-    let trg: Cell | string | null = view.getVisibleTerminal(edge, false);
+    const srcTerm = view.getVisibleTerminal(edge, true);
+    const trgTerm = view.getVisibleTerminal(edge, false);
@@
-    if (src != null && trg != null) {
-      src = ObjectIdentity.get(src);
-      trg = ObjectIdentity.get(trg);
+    if (srcTerm != null && trgTerm != null) {
+      const srcId = ObjectIdentity.get(srcTerm);
+      const trgId = ObjectIdentity.get(trgTerm);
@@
-      return (<string>src > <string>trg ? `${trg}-${src}` : `${src}-${trg}`) + pts;
+      return (srcId > trgId ? `${trgId}-${srcId}` : `${srcId}-${trgId}`) + pts;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 7d5cd02 and 39b54f4.

📒 Files selected for processing (1)
  • packages/core/src/view/layout/ParallelEdgeLayout.ts (7 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
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#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#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.
🧬 Code graph analysis (1)
packages/core/src/view/layout/ParallelEdgeLayout.ts (2)
packages/core/src/view/cell/Cell.ts (1)
  • Cell (66-888)
packages/core/src/internal/utils.ts (1)
  • isNullish (44-45)
⏰ 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 (ubuntu-24.04)
  • GitHub Check: build (macos-14)
  • GitHub Check: build (windows-2022)
  • GitHub Check: build
🔇 Additional comments (9)
packages/core/src/view/layout/ParallelEdgeLayout.ts (9)

25-25: Importing isNullish improves clarity and intent—LGTM

Good choice to centralize null/undefined checks.


28-31: JSDoc clarifications read better and match behavior

No functional change; improved readability.


39-56: Sample update to InternalEvent and strict equality is correct

The example now reflects the current event API and safe equality semantics.


69-79: Adding @default tags is helpful for API consumers

Nice doc enhancement without code noise.


86-93: Object.values over for-in on a null-proto dict—LGTM

Safer enumeration (no inherited props) and more direct iteration of buckets.


98-100: Typed return and prototype-less lookup are appropriate

Record<string, Cell[]> plus Object.create(null) avoids prototype pitfalls and clarifies usage.


105-107: Bucket init with nullish coalescing assignment is concise and correct

Clean push-path; no redundant checks.


111-114: for-of over provided cells—LGTM

Keeps intent clear; empty array remains truthy so behavior is unchanged.


127-132: Ignore nullability concern—no external callers of getEdgeId
Ripgrep shows getEdgeId is only invoked within ParallelEdgeLayout.ts at line 103, and its return value is already guarded by isNullish(id) before use. No downstream updates required.

Likely an incorrect or invalid review comment.

@tbouffard tbouffard merged commit d755d24 into main Aug 28, 2025
7 checks passed
@tbouffard tbouffard deleted the docs/parrallelEdgeLayout_jsdoc_improvements branch August 28, 2025 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Code refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant