Skip to content

Conversation

@lucasbordeau
Copy link
Contributor

@lucasbordeau lucasbordeau commented Nov 5, 2025

This PR fixes issues with one to many activity target bugs described here : #14280 (comment)

It also improves the request that fetches notes and tasks in index pages, to only fetch the notes and tasks identifier fields, thus reducing the amount of network load.

Fixes #14280

Copy link
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

This PR fixes the one-to-many activity targets display issue where only one chip was visible when not hovering, despite multiple values being selected.

Key Changes

  • New GQL field generation utility: Created generateActivityTargetGqlFields() to centralize and optimize GraphQL field generation for activity targets, replacing the older generateActivityTargetMorphFieldKeys() approach
  • Fixed visibility issues: Removed the hover-based opacity transition that was hiding chips in RecordInlineCellContainer
  • Overflow handling: Added overflow: clip container in TaskRow and fixed width (24px) for the chip counter in ExpandableList
  • Optimized data fetching: Set shouldOnlyLoadActivityIdentifiers: true for list views to only load necessary identifier fields instead of full relations
  • Code consolidation: Unified activity target field generation logic across show pages and list views

The fix properly addresses the root cause by ensuring chips remain visible and are properly clipped based on available width, while also optimizing the data fetching strategy.

Confidence Score: 4/5

  • This PR is safe to merge with minimal risk after removing commented code
  • The changes properly fix the display issue with good architectural improvements, but there's commented code that should be cleaned up. The refactoring is well-structured and the new utility function follows good patterns. No logic or syntax errors found.
  • Check useRecordsFieldVisibleGqlFields.ts to ensure commented code is removed before merge

Important Files Changed

File Analysis

Filename Score Overview
packages/twenty-front/src/modules/object-record/graphql/record-gql-fields/utils/generateActivityTargetGqlFields.ts 4/5 New utility function to generate GraphQL fields for activity targets with configurable depth and identifier loading. Replaces generateActivityTargetMorphFieldKeys with a more flexible approach.
packages/twenty-front/src/modules/ui/layout/expandable-list/components/ExpandableList.tsx 5/5 Fixed width constraint added to chip counter (24px) to ensure consistent sizing and prevent overflow display issues.
packages/twenty-front/src/modules/object-record/record-field/hooks/useRecordsFieldVisibleGqlFields.ts 4/5 Replaced old GQL field generation with new generateActivityTargetGqlFields utility, setting shouldOnlyLoadActivityIdentifiers: true to optimize data fetching. Contains commented out old code.
packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCellContainer.tsx 5/5 Removed hover-based opacity transition effect that was hiding display mode content, fixing visibility issues with inline cells.

Sequence Diagram

sequenceDiagram
    participant User
    participant TaskRow
    participant ActivityTargetsInlineCell
    participant RecordInlineCellContainer
    participant ExpandableList
    participant RecordChip
    participant GraphQL

    User->>TaskRow: View task with multiple targets
    TaskRow->>ActivityTargetsInlineCell: Render with maxWidth=200
    ActivityTargetsInlineCell->>GraphQL: Fetch activity targets<br/>(shouldOnlyLoadActivityIdentifiers: true)
    GraphQL-->>ActivityTargetsInlineCell: Return identifier fields only
    ActivityTargetsInlineCell->>RecordInlineCellContainer: Render display mode
    RecordInlineCellContainer->>ExpandableList: Render chips (isChipCountDisplayed)
    
    loop For each target
        ExpandableList->>RecordChip: Render chip
        ExpandableList->>ExpandableList: Check if overflowing
    end
    
    alt Chips overflow container
        ExpandableList->>ExpandableList: Set firstHiddenChildIndex
        ExpandableList->>User: Show visible chips + counter (+N)
    else All chips fit
        ExpandableList->>User: Show all chips
    end
    
    User->>ExpandableList: Click chip counter
    ExpandableList->>User: Show dropdown with all chips
Loading

Additional Comments (1)

  1. packages/twenty-front/src/modules/object-record/record-field/hooks/useRecordsFieldVisibleGqlFields.ts, line 80-89 (link)

    style: Remove commented out code before merging.

10 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@github-actions
Copy link
Contributor

github-actions bot commented Nov 5, 2025

🚀 Preview Environment Ready!

Your preview environment is available at: http://bore.pub:54402

This environment will automatically shut down when the PR is closed or after 5 hours.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hover 1 to Many field not showing all options (on the "one" side)

3 participants