fix(tag-input): add onInputChange to clear errors when new text is entered#2765
fix(tag-input): add onInputChange to clear errors when new text is entered#2765waleedlatif1 merged 2 commits intostagingfrom
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
|
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. |
|
@greptile |
…tered (#2765) * fix(tag-input): add onInputChange to clear errors when new text is entered * added paste case too
Summary
Type of Change
Testing
tested manually
Checklist