| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Previously, any value type could be passed for any style key without compile-time error, allowing bugs like passing a string for a boolean property. Using a generic constraint ensures the value type matches the key's declared type in CellStateStyle, catching mismatches at compile time.
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: d7675152-6b7f-417b-ab4b-76b5afbe6dbd You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file. Use the checkbox below for a quick retry:
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. ❤️ ShareComment @coderabbitai help to get the list of available commands and usage tips. |
Sorry, something went wrong.
|
Sorry, something went wrong.
| @@ -241,14 +241,14 @@ class GraphLayout { | |||
| * Disables or enables the edge style of the given edge. | |||
| */ | |||
| setEdgeStyleEnabled(edge: Cell, value: any): void { | |||
There was a problem hiding this comment.
suggestion: the type of the value parameter should be a boolean.Do we allow undefined?
Sorry, something went wrong.
| */ | ||
| setOrthogonalEdge(edge: Cell, value: any): void { | ||
| this.graph.setCellStyles('orthogonal', value ? '1' : '0', [edge]); | ||
| this.graph.setCellStyles('orthogonal', !!value, [edge]); |
There was a problem hiding this comment.
suggestion: the type of the value parameter should be a boolean. Do we allow undefined?
Sorry, something went wrong.
| this.setCellStyles(source ? 'exitPerimeter' : 'entryPerimeter', false, [ | ||
| edge, | ||
| ]); | ||
| } else { | ||
| this.setCellStyles(source ? 'exitPerimeter' : 'entryPerimeter', null, [edge]); | ||
| } |
There was a problem hiding this comment.
suggestion: there is a duplication here, the value is not the same depending on the result of the if condition, but the rest of the implementation is the same.
Sorry, something went wrong.
| @@ -201,7 +201,9 @@ export const ConnectionsMixin: PartialType = { | |||
|
|
|||
| // Only writes 0 since 1 is default | |||
There was a problem hiding this comment.
nitpick: adapt this comment (use boolean instead of number)
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This is a WIP
description for enforce type-safe value in setCellStyles
Previously, any value type could be passed for any style key without compile-time error, allowing bugs like passing a string for a boolean property.
Using a generic constraint ensures the value type matches the key's declared type in CellStateStyle, catching mismatches at compile
time.
Tasks
Increase the scope of this PR:
maxGraph/packages/core/src/view/mixin/ConnectionsMixin.ts
Lines 170 to 175 in 24357a7
maxGraph/packages/core/src/view/mixin/ConnectionsMixin.ts
Lines 202 to 206 in 24357a7
Other tasks
Notes
Covers #840
Should be merged after #1026