Skip to content

fix groupMode regression caused due to default value flip#15627

Merged
ehconitin merged 2 commits intomainfrom
fix-groumode-regression
Nov 5, 2025
Merged

fix groupMode regression caused due to default value flip#15627
ehconitin merged 2 commits intomainfrom
fix-groumode-regression

Conversation

@ehconitin
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

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' from GraphWidgetBarChart component 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
Loading

2 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Nov 5, 2025

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

Copy link
Copy Markdown
Contributor

@bosiraphael bosiraphael left a comment

Choose a reason for hiding this comment

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

LGTM

@ehconitin ehconitin merged commit 3f52102 into main Nov 5, 2025
58 checks passed
@ehconitin ehconitin deleted the fix-groumode-regression branch November 5, 2025 10:34
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Nov 5, 2025

Thanks @ehconitin for your contribution!
This marks your 243rd PR on the repo. You're top 1% of all our contributors 🎉
See contributor page - Share on LinkedIn - Share on Twitter

Contributions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants