-
Notifications
You must be signed in to change notification settings - Fork 18
fix(Versions): always show default color #3216
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
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.
Pull request overview
This PR fixes a bug where version colors could be undefined by ensuring a default color is always provided. The fix adds color: data?.color ?? DEFAULT_COLOR before spreading the data object, preventing the spread from overwriting the default with undefined.
Key Changes
- Imported
DEFAULT_COLORconstant fromgetVersionsColors - Added explicit color assignment with fallback to
DEFAULT_COLORinparseNodeGroupsToPreparedVersions
| color: data?.color ?? DEFAULT_COLOR, | ||
| ...data, |
Copilot
AI
Dec 12, 2025
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.
The fix applies the default color before spreading the data object to ensure color is always defined. However, the same issue exists in the parseNodesToPreparedVersions function above (lines 27-33). That function also spreads data without setting a default color first, which means it can have the same problem where color might be undefined. Consider applying the same fix pattern there for consistency.
| color: data?.color ?? DEFAULT_COLOR, | |
| ...data, | |
| ...data, | |
| color: data?.color ?? DEFAULT_COLOR, |
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.
Additional Comments (1)
-
src/utils/versions/parseNodesToVersionsValues.ts, line 23-34 (link)logic:
parseNodesToPreparedVersionsshould also explicitly set default color likeparseNodeGroupsToPreparedVersionsdoes. Without this, versions without color data will haveundefinedcolor property.
1 file reviewed, 1 comment
Greptile Overview
Greptile Summary
Fixed
parseNodeGroupsToPreparedVersionsto always include a default color when version data is missing, preventingundefinedcolor values in the UI.DEFAULT_COLORconstant fromgetVersionsColorscolor: data?.color ?? DEFAULT_COLORbefore spreading dataVersionsBarcomponent always receives valid color values for rendering version indicatorsIssue: The sibling function
parseNodesToPreparedVersions(lines 23-34) has the same problem but was not fixed. Both functions returnPreparedVersionobjects consumed byVersionsBar, which expects thecolorproperty to be defined.Confidence Score: 3/5
parseNodeGroupsToPreparedVersions, but the identical functionparseNodesToPreparedVersionshas the same bug and was not fixed. Both functions are used in production and should have consistent behavior.parseNodesToPreparedVersionsfunction insrc/utils/versions/parseNodesToVersionsValues.ts:23-34Important Files Changed
File Analysis
parseNodeGroupsToPreparedVersions, butparseNodesToPreparedVersionshas same issueSequence Diagram
sequenceDiagram participant Versions as Versions Component participant Utils as useGetPreparedVersions participant Parser as parseNodeGroupsToPreparedVersions participant Colors as getVersionsColors participant VersionsBar as VersionsBar Component Versions->>Utils: Request prepared versions Utils->>Utils: Get versionsDataMap alt ClusterInfo V2 Utils->>Parser: parseNodeGroupsToPreparedVersions(groups, versionsDataMap) else Nodes with tableGroups Utils->>Parser: parseNodeGroupsToPreparedVersions(tableGroups, versionsDataMap) else Nodes array Utils->>Parser: parseNodesToPreparedVersions(nodes, versionsDataMap) end Parser->>Colors: getMinorVersion(version) Colors-->>Parser: minorVersion Parser->>Parser: Get color from versionsDataMap Parser->>Parser: Apply DEFAULT_COLOR fallback (NEW) Parser-->>Utils: PreparedVersion[] with color Utils-->>Versions: preparedVersions Versions->>VersionsBar: Render with preparedVersions VersionsBar->>VersionsBar: Use item.color for stylingCI Results
Test Status:⚠️ FLAKY
📊 Full Report
Test Changes Summary ⏭️2
⏭️ Skipped Tests (2)
Bundle Size: ✅
Current: 62.50 MB | Main: 62.50 MB
Diff: +0.17 KB (0.00%)
✅ Bundle size unchanged.
ℹ️ CI Information