clear input when opening tags dropdown

This commit is contained in:
kv
2024-01-17 00:12:58 -08:00
parent 73f624d6a1
commit bb98d3209d
+4
View File
@@ -57,6 +57,10 @@ export const ManageTags = ({ target }: { target: TargetExcludingSystem }) => {
if (resource && !tags) setTags(resource.tags);
}, [resource, tags]);
useEffect(() => {
if (open) setInput("");
}, [open]);
const update_tags = (tag: Types.CustomTag) => {
const exists = tags?.some((id) => id === tag._id?.$oid);
if (exists) return setTags((t) => t?.filter((id) => id !== tag._id?.$oid));