Skip to content

Commit 8690489

Browse files
committed
fix(tag-input): add onInputChange to clear errors when new text is entered
1 parent 9a16e7c commit 8690489

File tree

2 files changed

+8
-1
lines changed
  • apps/sim
    • app/workspace/[workspaceId]/w/components/sidebar/components/workspace-header/components/invite-modal
    • components/emcn/components/tag-input

2 files changed

+8
-1
lines changed

apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workspace-header/components/invite-modal/invite-modal.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,7 @@ export function InviteModal({ open, onOpenChange, workspaceName }: InviteModalPr
657657
items={emailItems}
658658
onAdd={(value) => addEmail(value)}
659659
onRemove={removeEmailItem}
660+
onInputChange={() => setErrorMessage(null)}
660661
placeholder={
661662
!userPerms.canAdmin
662663
? 'Only administrators can invite new members'

apps/sim/components/emcn/components/tag-input/tag-input.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ export interface TagInputProps extends VariantProps<typeof tagInputVariants> {
166166
onAdd: (value: string) => boolean
167167
/** Callback when a tag is removed (receives value, index, and isValid) */
168168
onRemove: (value: string, index: number, isValid: boolean) => void
169+
/** Callback when the input value changes (useful for clearing errors) */
170+
onInputChange?: (value: string) => void
169171
/** Placeholder text for the input */
170172
placeholder?: string
171173
/** Placeholder text when there are existing tags */
@@ -207,6 +209,7 @@ const TagInput = React.forwardRef<HTMLInputElement, TagInputProps>(
207209
items,
208210
onAdd,
209211
onRemove,
212+
onInputChange,
210213
placeholder = 'Enter values',
211214
placeholderWithTags = 'Add another',
212215
disabled = false,
@@ -422,7 +425,10 @@ const TagInput = React.forwardRef<HTMLInputElement, TagInputProps>(
422425
name={name}
423426
type='text'
424427
value={inputValue}
425-
onChange={(e) => setInputValue(e.target.value)}
428+
onChange={(e) => {
429+
setInputValue(e.target.value)
430+
onInputChange?.(e.target.value)
431+
}}
426432
onKeyDown={handleKeyDown}
427433
onPaste={handlePaste}
428434
onBlur={handleBlur}

0 commit comments

Comments
 (0)