Skip to content

Conversation

@RajdeepDs
Copy link

Previously, single-item fields maxItemCount: 1 didn’t show updated values after pressing Enter the UI only refreshed on click outside. This happened because the items list was hidden while shouldAutoEditSingleItem remained true.

This PR updates the render condition to also check !isInputDisplayed, ensuring the items list re-renders immediately after editing.

Result: Instant UI updates on Enter with no impact on multi-item fields.

Fixes #15792

@github-actions
Copy link
Contributor

Welcome!

Hello there, congrats on your first PR! We're excited to have you contributing to this project.
By submitting your Pull Request, you acknowledge that you agree with the terms of our Contributor License Agreement.

Generated by 🚫 dangerJS against 0049acd

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Nov 14, 2025

Greptile Overview

Greptile Summary

This PR fixes a UI update issue where single-item fields (maxItemCount: 1) didn't immediately show updated values after pressing Enter. The fix updates the render condition on line 220 from !shouldAutoEditSingleItem to (!shouldAutoEditSingleItem || !isInputDisplayed), ensuring the items list re-renders when the input is hidden.

Key Changes:

  • Modified the conditional rendering logic to also check !isInputDisplayed
  • Enables immediate UI updates on Enter for single-item fields like domain names
  • No impact on multi-item field behavior

Technical Analysis:
The issue occurred because when shouldAutoEditSingleItem is true (for fields with maxItemCount === 1 and one existing item), the items list was hidden even after isInputDisplayed was set to false on Enter. The new condition (!shouldAutoEditSingleItem || !isInputDisplayed) correctly shows the list when either condition is met, resolving the delayed update.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The fix is a minimal, surgical change to a single boolean condition that directly addresses the reported bug. The logic has been verified across multiple scenarios (single-item fields with/without existing values, multi-item fields) and maintains backward compatibility. The change follows the existing code patterns and doesn't introduce new dependencies or side effects.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/MultiItemFieldInput.tsx 5/5 Fixed UI update issue for single-item fields by updating render condition to check both shouldAutoEditSingleItem and isInputDisplayed state

Sequence Diagram

sequenceDiagram
    participant User
    participant MultiItemFieldInput
    participant State
    participant UI
    
    Note over State: Initial: items.length=1, maxItemCount=1<br/>shouldAutoEditSingleItem=true<br/>isInputDisplayed=true
    
    User->>MultiItemFieldInput: Types new value in input
    MultiItemFieldInput->>State: Update inputValue
    
    User->>MultiItemFieldInput: Presses Enter
    MultiItemFieldInput->>MultiItemFieldInput: handleSubmitInput()
    MultiItemFieldInput->>State: onChange(updatedItems)
    MultiItemFieldInput->>State: setIsInputDisplayed(false)
    
    Note over State: After Enter: items.length=1<br/>shouldAutoEditSingleItem=true<br/>isInputDisplayed=false
    
    MultiItemFieldInput->>UI: Re-render with new condition
    
    alt Before Fix (line 220)
        UI->>UI: Check: !!items.length && !shouldAutoEditSingleItem
        Note over UI: true && !true = false<br/>Items list NOT shown
    else After Fix (line 220)
        UI->>UI: Check: !!items.length && (!shouldAutoEditSingleItem || !isInputDisplayed)
        Note over UI: true && (!true || !false) = true<br/>Items list SHOWN immediately
    end
    
    UI->>User: Display updated value
Loading

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.

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@github-actions
Copy link
Contributor

🚀 Preview Environment Ready!

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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Updating a domain name is not working correctly

1 participant