diff --git a/website/src/components/Form/Items/Tag/index.tsx b/website/src/components/Form/Items/Tag/index.tsx index 97ec0a0b..615432fb 100644 --- a/website/src/components/Form/Items/Tag/index.tsx +++ b/website/src/components/Form/Items/Tag/index.tsx @@ -39,13 +39,15 @@ export default function TagFormItem({ } if (validateTag()) { const tag: TagType = { label, color }; - setTags([...tags, tag]); - onTagUpdate(tags); + const newTags = [...tags, tag]; + setTags(newTags); + onTagUpdate(newTags); } }; const delTag = (index: number) => { - setTags(tags.filter((_, i) => i !== index)); - onTagUpdate(tags); + const newTags = tags.filter((_, i) => i !== index); + setTags(newTags); + onTagUpdate(newTags); }; const onChangeColor = (color: ColorResult) => { setColor(color.hex as TagType["color"]);