diff --git a/entrypoints/sidepanel/components/TagsInput.tsx b/entrypoints/sidepanel/components/TagsInput.tsx index be5993e..63ef2a5 100644 --- a/entrypoints/sidepanel/components/TagsInput.tsx +++ b/entrypoints/sidepanel/components/TagsInput.tsx @@ -11,8 +11,12 @@ export default function TagsInput({ allKnownTags, initialTags }: TagsInputProps) const [hiddenValue, setHiddenValue] = useState(JSON.stringify(initialTags)); const handleChange = useCallback((newTags: string[]) => { - setTags(newTags); - setHiddenValue(JSON.stringify(newTags)); + // Filter out empty tags and trim whitespace + const filteredTags = newTags + .map(tag => tag.trim()) + .filter(tag => tag.length > 0); + setTags(filteredTags); + setHiddenValue(JSON.stringify(filteredTags)); }, []); return (