fix groupMode regression caused due to default value flip#15627
Merged
fix groupMode regression caused due to default value flip#15627
Conversation
Contributor
There was a problem hiding this comment.
Greptile Overview
Greptile Summary
Fixed inverted logic in getEffectiveGroupMode utility that was causing bar charts to display in the wrong mode (grouped vs stacked).
- Removed incorrect default value
groupMode = 'grouped'fromGraphWidgetBarChartcomponent to properly handle undefined state - Corrected the enum mapping in
getEffectiveGroupMode: now correctly maps'GROUPED'→'grouped'and defaults to'stacked'for all other values - This fixes the regression introduced in PR #15585 where the logic was accidentally inverted
Confidence Score: 5/5
- This PR is safe to merge - it fixes a clear logic bug with a straightforward correction
- The changes are minimal, well-scoped, and directly address the regression. The fix correctly inverts the previously inverted logic to match the GraphQL enum values with their lowercase representations. The removal of the default value aligns with the backend changes from PR #15585.
- No files require special attention
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/components/GraphWidgetBarChart.tsx | 5/5 | Removed incorrect default value for groupMode prop to allow proper handling of undefined state |
| packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/utils/getEffectiveGroupMode.ts | 5/5 | Fixed inverted logic mapping GraphQL enum to lowercase string values |
Sequence Diagram
sequenceDiagram
participant Renderer as GraphWidgetBarChartRenderer
participant Util as getEffectiveGroupMode
participant Chart as GraphWidgetBarChart
participant Nivo as ResponsiveBar (nivo)
Renderer->>Renderer: Check hasGroupByOnSecondaryAxis
Renderer->>Util: getEffectiveGroupMode(config.groupMode, hasGroupByOnSecondaryAxis)
alt hasGroupByOnSecondaryAxis is false
Util-->>Renderer: undefined
else groupMode is 'GROUPED'
Util-->>Renderer: 'grouped'
else groupMode is 'STACKED' or other
Util-->>Renderer: 'stacked'
end
Renderer->>Chart: Pass groupMode prop
Chart->>Chart: Use groupMode in CustomBarItem
Chart->>Chart: Use groupMode in CustomTotalsLayer
Chart->>Nivo: Pass groupMode to ResponsiveBar
Nivo-->>Chart: Render with correct bar arrangement
2 files reviewed, no comments
Contributor
|
🚀 Preview Environment Ready! Your preview environment is available at: http://bore.pub:6089 This environment will automatically shut down when the PR is closed or after 5 hours. |
Contributor
|
Thanks @ehconitin for your contribution! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

No description provided.