Skip to content

Commit

Permalink
fix: make dietary list default to empty array
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronchan32 committed Feb 17, 2024
1 parent ce9a496 commit f94cca4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions frontend/src/components/StudentFormButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ export default function StudentFormButton({
setValue: setCalendarValue,
reset,
handleSubmit,
} = useForm<StudentFormData>({ 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<StudentFormData>({
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);

Expand Down

0 comments on commit f94cca4

Please sign in to comment.