fix: robustly handle other_items as string, string[], or undefined in Other Items section

This commit is contained in:
Ryderjj89
2025-05-04 17:31:15 -04:00
parent 80e144ab13
commit 09f4ffc328
2 changed files with 14 additions and 2 deletions

View File

@@ -770,7 +770,13 @@ const EventAdmin: React.FC = () => {
{(() => {
const allOtherItems = rsvps
.map(r => r.other_items)
.filter((item): item is string => typeof item === 'string' && item.trim() !== '');
.flatMap(item =>
Array.isArray(item)
? item.filter((s): s is string => typeof s === 'string' && s.trim() !== '')
: typeof item === 'string' && item.trim() !== ''
? [item]
: []
);
return allOtherItems.length > 0
? allOtherItems.join(', ')
: 'No other items have been brought';