diff --git a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workspace-header/components/invite-modal/invite-modal.tsx b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workspace-header/components/invite-modal/invite-modal.tsx index 4fc754478f..bd37fe4f18 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workspace-header/components/invite-modal/invite-modal.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workspace-header/components/invite-modal/invite-modal.tsx @@ -657,6 +657,7 @@ export function InviteModal({ open, onOpenChange, workspaceName }: InviteModalPr items={emailItems} onAdd={(value) => addEmail(value)} onRemove={removeEmailItem} + onInputChange={() => setErrorMessage(null)} placeholder={ !userPerms.canAdmin ? 'Only administrators can invite new members' diff --git a/apps/sim/components/emcn/components/tag-input/tag-input.tsx b/apps/sim/components/emcn/components/tag-input/tag-input.tsx index a866220e66..8a1c2e832a 100644 --- a/apps/sim/components/emcn/components/tag-input/tag-input.tsx +++ b/apps/sim/components/emcn/components/tag-input/tag-input.tsx @@ -166,6 +166,8 @@ export interface TagInputProps extends VariantProps { onAdd: (value: string) => boolean /** Callback when a tag is removed (receives value, index, and isValid) */ onRemove: (value: string, index: number, isValid: boolean) => void + /** Callback when the input value changes (useful for clearing errors) */ + onInputChange?: (value: string) => void /** Placeholder text for the input */ placeholder?: string /** Placeholder text when there are existing tags */ @@ -207,6 +209,7 @@ const TagInput = React.forwardRef( items, onAdd, onRemove, + onInputChange, placeholder = 'Enter values', placeholderWithTags = 'Add another', disabled = false, @@ -344,10 +347,12 @@ const TagInput = React.forwardRef( }) if (addedCount === 0 && pastedValues.length === 1) { - setInputValue(inputValue + pastedValues[0]) + const newValue = inputValue + pastedValues[0] + setInputValue(newValue) + onInputChange?.(newValue) } }, - [onAdd, inputValue] + [onAdd, inputValue, onInputChange] ) const handleBlur = React.useCallback(() => { @@ -422,7 +427,10 @@ const TagInput = React.forwardRef( name={name} type='text' value={inputValue} - onChange={(e) => setInputValue(e.target.value)} + onChange={(e) => { + setInputValue(e.target.value) + onInputChange?.(e.target.value) + }} onKeyDown={handleKeyDown} onPaste={handlePaste} onBlur={handleBlur}