Skip to content

Conversation

@tbouffard
Copy link
Member

@tbouffard tbouffard commented May 3, 2025

Introduce the ElbowValue type.

Also add a script to build all examples.
This simplifies the maintenance of the GH workflow and let easily built all examples locally with a single command.

BREAKING CHANGES: the ELBOW enum has been removed. Use the ElbowValue type instead.

Notes

Covers #378

Impact on the size of the examples

Example v0.19.0 With #795 and #796 With #798, #799, #800 and #801
js-example 475.30 kB 474.01 kB 470.31 kB
js-example-selected-features 415.10 kB 413.98 kB 410.72 kB
js-example-without-default 347.33 kB 346.21 kB 343.09 kB
ts-example 438.64 kB 437.42 kB 435.02 kB
ts-example-selected-features 380.70 kB 379.54 kB 377.37 kB
ts-example-without-default 329.90 kB 328.74 kB 326.63 kB

Summary by CodeRabbit

Summary by CodeRabbit

  • Breaking Changes

    • The enum for elbow styles has been removed and replaced with a string type. If you previously used constants.ELBOW, update your code to use the string values 'horizontal' or 'vertical' directly.
  • Documentation

    • The changelog has been updated to reflect the removal of the elbow enum and its replacement with a string type.
  • Style

    • Code comments and examples now use string literals for elbow styles instead of the removed enum.
  • Chores

    • Build configuration updated to slightly lower chunk size warning limits in multiple example projects.
    • A new script was added to streamline building all example projects collectively.
    • The CI workflow was improved by consolidating multiple build steps into a single streamlined step.

Introduce the `ElbowValue` type.

BREAKING CHANGES: the ELBOW enum has been removed. Use the `ElbowValue` type instead.
@tbouffard tbouffard added the refactor Code refactoring label May 3, 2025
@coderabbitai
Copy link

coderabbitai bot commented May 3, 2025

Warning

Rate limit exceeded

@tbouffard has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 17 minutes and 4 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between c9258fd and f7ca58b.

📒 Files selected for processing (1)
  • build-all-examples.bash (1 hunks)

Walkthrough

This change removes the ELBOW enum from the codebase and replaces its usage with a new string literal type alias, ElbowValue, which represents 'horizontal' | 'vertical'. All references to the enum are updated to use string literals or the new type alias. Documentation and code comments are adjusted accordingly, and imports of the removed enum are eliminated from affected files. No changes are made to the logic or structure of public APIs, except for the updated type annotation.

Changes

File(s) Change Summary
packages/core/src/util/Constants.ts Removed the exported ELBOW enum and its members.
packages/core/src/types.ts Introduced exported type alias ElbowValue; updated CellStateStyle.elbow to use ElbowValue.
packages/core/src/view/handler/ElbowEdgeHandler.ts
packages/core/src/view/style/edge/Elbow.ts
Removed import of ELBOW and replaced enum usage with string literals in conditional checks.
packages/core/src/view/mixins/EdgeMixin.type.ts Updated code comment example to use string literal instead of Constants.ELBOW.VERTICAL.
packages/html/stories/Indicators.stories.js Removed import of constants and replaced constants.ELBOW.VERTICAL with string literal 'vertical'.
.github/workflows/build.yml
build-all-examples.bash
Consolidated example builds into a single script; added new script to build all example packages.
packages/ts-example*/vite.config.js Decreased chunkSizeWarningLimit values slightly in all three example Vite config files.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CellStateStyle
    participant ElbowEdgeHandler
    participant Elbow

    User->>CellStateStyle: Set elbow property (ElbowValue)
    ElbowEdgeHandler->>CellStateStyle: Read elbow property
    ElbowEdgeHandler->>ElbowEdgeHandler: Compare elbow to 'vertical' or 'horizontal'
    Elbow->>CellStateStyle: Access elbow property
    Elbow->>Elbow: Compare elbow to 'vertical'
Loading

Possibly related PRs

✨ Finishing Touches
  • 📝 Generate Docstrings

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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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 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.

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

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 5f0b2f3 and 48160dc.

📒 Files selected for processing (7)
  • CHANGELOG.md (1 hunks)
  • packages/core/src/types.ts (2 hunks)
  • packages/core/src/util/Constants.ts (0 hunks)
  • packages/core/src/view/handler/ElbowEdgeHandler.ts (2 hunks)
  • packages/core/src/view/mixins/EdgeMixin.type.ts (1 hunks)
  • packages/core/src/view/style/edge/Elbow.ts (1 hunks)
  • packages/html/stories/Indicators.stories.js (2 hunks)
💤 Files with no reviewable changes (1)
  • packages/core/src/util/Constants.ts
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: build (windows-2022)
  • GitHub Check: build (macos-14)
  • GitHub Check: build (ubuntu-22.04)
  • GitHub Check: build
🔇 Additional comments (8)
packages/core/src/view/style/edge/Elbow.ts (1)

69-69: String literal replacement looks good.

The replacement of ELBOW.VERTICAL enum with the string literal 'vertical' aligns with the PR objective to remove the ELBOW enum in favor of the new ElbowValue type.

packages/html/stories/Indicators.stories.js (2)

18-18: Import statement correctly updated.

The removal of the constants import aligns with the PR objective of removing the ELBOW enum.


61-61: String literal replacement looks good.

The replacement of constants.ELBOW.VERTICAL with the string literal 'vertical' maintains the same behavior while removing the dependency on the enum.

CHANGELOG.md (1)

19-19: Breaking change properly documented.

The changelog has been correctly updated to document the breaking change from constants.ELBOW to ElbowValue, providing clear migration guidance for users.

packages/core/src/view/handler/ElbowEdgeHandler.ts (2)

20-20: Import statement correctly updated.

The import statement has been updated to only import CURSOR from Constants, removing the ELBOW enum import which is being removed from the codebase.


116-116: String literal replacement looks good.

The replacement of ELBOW.VERTICAL enum with the string literal 'vertical' maintains the same behavior while aligning with the PR objective to remove the enum.

packages/core/src/types.ts (2)

1471-1474: Good addition of the ElbowValue type alias.

Adding the type alias to replace the enum is a clean approach and aligns with TypeScript best practices for string literal types.


208-208: Appropriate type update for elbow property.

The property now uses the newly defined ElbowValue type alias instead of an inline union type, maintaining consistency throughout the codebase.

tbouffard added 3 commits May 3, 2025 20:23
This simplifies the maintenance of the GH workflow and let easily built all examples locally with a single command.
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)
build-all-examples.bash (1)

7-15: Handle unmatched globs and consider parallel builds
By default, if no directories match the glob, the loop will iterate once with the literal pattern. You may want to enable nullglob or add an explicit check to avoid silent skips. Additionally, for faster CI runs, you could parallelize builds (e.g., with xargs -P or GNU parallel).

Example diff to enable nullglob:

 #!/usr/bin/env bash
-set -euo pipefail
+set -euo pipefail
+shopt -s nullglob
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0618833 and c9258fd.

📒 Files selected for processing (2)
  • .github/workflows/build.yml (1 hunks)
  • build-all-examples.bash (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .github/workflows/build.yml
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build (windows-2022)
🔇 Additional comments (3)
build-all-examples.bash (3)

1-2: Robust shell setup with strict mode
Using #!/usr/bin/env bash combined with set -euo pipefail is excellent for catching errors early and avoiding unbound variables.


4-5: Clear startup messaging
The comment and initial echo clearly communicate the script’s purpose to users.


17-18: Confirm overall success
The final echo provides clear feedback once all builds complete.

@sonarqubecloud
Copy link

sonarqubecloud bot commented May 3, 2025

@tbouffard tbouffard merged commit 4d7448d into main May 3, 2025
7 checks passed
@tbouffard tbouffard deleted the refactor/378-remove_ELBOW_enum branch May 3, 2025 19:11
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