From 61f4bb522f01d3629acc8d72362613542dd40ed3 Mon Sep 17 00:00:00 2001 From: rito528 <39003544+rito528@users.noreply.github.com> Date: Thu, 18 Apr 2024 01:17:38 +0900 Subject: [PATCH] =?UTF-8?q?docs:=20questionType=E3=81=AEuseEffect=E3=81=AB?= =?UTF-8?q?=E3=82=B3=E3=83=A1=E3=83=B3=E3=83=88=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/(authed)/admin/forms/create/CreateForm.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/(authed)/admin/forms/create/CreateForm.tsx b/src/app/(authed)/admin/forms/create/CreateForm.tsx index a146fb81..ef49c994 100644 --- a/src/app/(authed)/admin/forms/create/CreateForm.tsx +++ b/src/app/(authed)/admin/forms/create/CreateForm.tsx @@ -62,7 +62,9 @@ const QuestionComponent = ({ useEffect(() => { if (useWatchQuestionType === 'TEXT') { removeChoices(); - } else { + } else if (choicesField.length === 0) { + // NOTE: choicesField.lengthが0であることを確認しないと + // 単一選択 -> 複数選択 -> 単一選択のように変更した場合に選択肢の入力欄が増加してしまう addChoice(); } }, [useWatchQuestionType, addChoice, removeChoices]);