fix null sub in select

This commit is contained in:
keyan 2024-01-03 19:45:30 -06:00
parent 40aa64546a
commit 6a600c2043
2 changed files with 4 additions and 4 deletions

View File

@ -855,11 +855,11 @@ export function Select ({ label, items, groupClassName, onChange, noForm, overri
if (item && typeof item === 'object') {
return (
<optgroup key={item.label} label={item.label}>
{item.items.map(item => <option key={item} value={item.toLowerCase()}>{item}</option>)}
{item.items.map(item => <option key={item} value={item?.toLowerCase()}>{item}</option>)}
</optgroup>
)
} else {
return <option key={item} value={item.toLowerCase()}>{item}</option>
return <option key={item} value={item?.toLowerCase()}>{item}</option>
}
})}
</BootstrapForm.Select>

View File

@ -64,10 +64,10 @@ export default function SubSelect ({ prependSubs, sub, onChange, appendSubs, fil
const subs = useSubs({ prependSubs, sub, filterSubs, appendSubs })
const valueProps = props.noForm
? {
value: sub.toLowerCase()
value: sub?.toLowerCase()
}
: {
overrideValue: sub.toLowerCase()
overrideValue: sub?.toLowerCase()
}
return (