From c5e114dc7fd73fad80be10305df374ab0a761dbd Mon Sep 17 00:00:00 2001 From: StarHeart Date: Thu, 1 Feb 2024 10:29:03 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20Docs:=20=E4=BF=AE=E5=A4=8D=E8=A1=A8?= =?UTF-8?q?=E5=8D=95=E6=A0=87=E7=AD=BE=E7=8A=B6=E6=80=81=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=20(#2558)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- website/src/components/Form/Items/Tag/index.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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"]);