From 8690489828a43b0baf2d02829acb9e46027c4cfa Mon Sep 17 00:00:00 2001 From: waleed Date: Sat, 10 Jan 2026 13:29:30 -0800 Subject: [PATCH 1/2] fix(tag-input): add onInputChange to clear errors when new text is entered --- .../components/invite-modal/invite-modal.tsx | 1 + .../components/emcn/components/tag-input/tag-input.tsx | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) 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..1dc6b234b0 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, @@ -422,7 +425,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} From 2d5d2a342bc315e02b08b37a63dba8bad16bce13 Mon Sep 17 00:00:00 2001 From: waleed Date: Sat, 10 Jan 2026 16:45:45 -0800 Subject: [PATCH 2/2] added paste case too --- apps/sim/components/emcn/components/tag-input/tag-input.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 1dc6b234b0..8a1c2e832a 100644 --- a/apps/sim/components/emcn/components/tag-input/tag-input.tsx +++ b/apps/sim/components/emcn/components/tag-input/tag-input.tsx @@ -347,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(() => {