-
Notifications
You must be signed in to change notification settings - Fork 3.2k
fix(tag-input): add onInputChange to clear errors when new text is entered #2765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile OverviewGreptile SummaryAdds an optional Confidence Score: 5/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
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
|
There was a problem hiding this 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
Additional Comments (1)
Prompt To Fix With AIThis 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. |
There was a problem hiding this 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
Summary
Type of Change
Testing
tested manually
Checklist