Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • add onInputChange to clear errors when new text is entered

Type of Change

  • New feature

Testing

tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Jan 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Review Updated (UTC)
docs Skipped Skipped Jan 11, 2026 0:45am

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 10, 2026

Greptile Overview

Greptile Summary

Adds an optional onInputChange callback to the TagInput component, enabling parent components to clear error messages when users modify the input field. The callback is integrated into the invite modal to clear error messages as soon as users start typing, improving the user experience by removing stale error messages immediately.

Confidence Score: 5/5

  • Clean implementation with proper callback semantics and correct integration
  • The implementation is well-designed and follows React best practices. The onInputChange callback is correctly invoked only when the user actively modifies the input (typing or pasting), not when the component programmatically clears the input after tag addition. This preserves validation errors set by the onAdd callback while allowing parent components to clear errors when users start making changes. The integration in the invite modal is straightforward and correct. The code includes proper JSDoc documentation and maintains consistency with the existing codebase patterns.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
apps/sim/components/emcn/components/tag-input/tag-input.tsx 5/5 Adds optional onInputChange callback with proper implementation; correctly called only when user modifies input

Sequence Diagram

sequenceDiagram
    participant User
    participant TagInput
    participant InviteModal
    participant addEmail

    User->>TagInput: Types invalid email
    TagInput->>InviteModal: onInputChange(value)
    InviteModal->>InviteModal: setErrorMessage(null)
    
    User->>TagInput: Presses Enter
    TagInput->>InviteModal: onAdd(value)
    InviteModal->>addEmail: Validate email
    addEmail->>InviteModal: Returns false
    InviteModal->>InviteModal: setErrorMessage("error")
    TagInput->>TagInput: Clear input (no onInputChange)
    Note over TagInput,InviteModal: Error persists as intended
    
    User->>TagInput: Starts typing again
    TagInput->>InviteModal: onInputChange(newValue)
    InviteModal->>InviteModal: setErrorMessage(null)
    Note over InviteModal: Error cleared immediately
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, 1 comment

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 10, 2026

Additional Comments (1)

apps/sim/components/emcn/components/tag-input/tag-input.tsx
When a single pasted value is not added and gets appended to the input, onInputChange should be called to clear any existing error messages. Without this, if there's an error message displayed (e.g., "already a member"), it will persist even though the user has modified the input by pasting.

        if (addedCount === 0 && pastedValues.length === 1) {
          setInputValue(inputValue + pastedValues[0])
          onInputChange?.(inputValue + pastedValues[0])
        }
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/sim/components/emcn/components/tag-input/tag-input.tsx
Line: 349:351

Comment:
When a single pasted value is not added and gets appended to the input, `onInputChange` should be called to clear any existing error messages. Without this, if there's an error message displayed (e.g., "already a member"), it will persist even though the user has modified the input by pasting.

```suggestion
        if (addedCount === 0 && pastedValues.length === 1) {
          setInputValue(inputValue + pastedValues[0])
          onInputChange?.(inputValue + pastedValues[0])
        }
```

How can I resolve this? If you propose a fix, please make it concise.

@waleedlatif1
Copy link
Collaborator Author

@greptile

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.

No files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@waleedlatif1 waleedlatif1 merged commit ab32a19 into staging Jan 11, 2026
10 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/invite-modal branch January 11, 2026 00:49
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