diff --git a/app/api/guests.tsx b/app/api/guests.tsx index ce4f232..f433a53 100644 --- a/app/api/guests.tsx +++ b/app/api/guests.tsx @@ -12,8 +12,8 @@ export function loadGuests(onLoad?: (guests: Guest[]) => void) { id: record.id, name: record.name, status: record.status, - group_name: record.group.name, - groupId: record.group.id, + group_name: record.group?.name || 'Not grouped', + groupId: record.group?.id, }); })); }, (error) => { diff --git a/app/ui/components/guest-form-dialog.tsx b/app/ui/components/guest-form-dialog.tsx index bf94230..8e77e54 100644 --- a/app/ui/components/guest-form-dialog.tsx +++ b/app/ui/components/guest-form-dialog.tsx @@ -21,17 +21,17 @@ export default function GuestFormDialog({ groups, onCreate, onHide, guest, visib }) { const [name, setName] = useState(guest?.name || ''); - const [group, setGroup] = useState(guest?.groupId || null); - const [status, setStatus] = useState(guest?.status || null); + const [group, setGroup] = useState(guest?.groupId || undefined); + const [status, setStatus] = useState(guest?.status || undefined); function resetForm() { setName(''); - setGroup(null); - setStatus(null); + setGroup(undefined); + setStatus(undefined); } function submitGuest() { - if (!(name && group && status)) { + if (!(name && status)) { return } @@ -76,7 +76,7 @@ export default function GuestFormDialog({ groups, onCreate, onHide, guest, visib } /> -