fix: ensure consistent array handling in RSVPForm items selection

This commit is contained in:
Your Name
2025-04-29 19:40:38 -04:00
parent ddd0ce58c0
commit dda3242e1a

View File

@@ -202,20 +202,16 @@ const RSVPForm: React.FC = () => {
<Select
multiple
name="items_bringing"
value={formData.items_bringing}
value={formData.items_bringing || []}
onChange={handleItemsChange}
input={<OutlinedInput label="What items are you bringing?" />}
renderValue={(selected) => (
renderValue={(selected: string[]) => (
<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 0.5 }}>
{Array.isArray(selected) ? selected.map((value) => (
{(selected || []).map((value) => (
<Typography key={value} variant="body2">
{value}
</Typography>
)) : (
<Typography variant="body2">
{selected}
</Typography>
)}
))}
</Box>
)}
>