Skip to content

Commit

Permalink
docs: questionTypeのuseEffectにコメントを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
rito528 committed Apr 17, 2024
1 parent 36384e6 commit 61f4bb5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/app/(authed)/admin/forms/create/CreateForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down

0 comments on commit 61f4bb5

Please sign in to comment.