From f94cca4a3bbdcd5680a07403189a2d18e923059e Mon Sep 17 00:00:00 2001 From: Aaron Chan <42254254+aaronchan32@users.noreply.github.com> Date: Sat, 17 Feb 2024 00:18:21 -0800 Subject: [PATCH] fix: make dietary list default to empty array --- frontend/src/components/StudentFormButton.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/StudentFormButton.tsx b/frontend/src/components/StudentFormButton.tsx index 599b8793..279fc019 100644 --- a/frontend/src/components/StudentFormButton.tsx +++ b/frontend/src/components/StudentFormButton.tsx @@ -40,8 +40,10 @@ export default function StudentFormButton({ setValue: setCalendarValue, reset, handleSubmit, - } = useForm({ defaultValues: { varying_programs: [], regular_programs: [] } }); - //Default values can be set for all fields but I specified these two fields because the checkbox value can sometimes be a string if it's a single value rather than array of strings. https://github.com/react-hook-form/react-hook-form/releases/tag/v7.30.0 + } = useForm({ + defaultValues: { varying_programs: [], regular_programs: [], dietary: [] }, + }); + //Default values can be set for all fields but I specified these three fields because the checkbox value can sometimes be a string if it's a single value rather than array of strings. https://github.com/react-hook-form/react-hook-form/releases/tag/v7.30.0 const [openForm, setOpenForm] = useState(false);