mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
fix(frontend): prevent Select.Item crash on empty-string enum values
Radix UI's Select.Item throws when value="". The SelectWidget used
value={value ?? ""} which passes empty string for null/undefined form
values, and passed enum options through without filtering.
- Use value || undefined to show placeholder for unset values
- Filter out empty-string options before rendering SelectItems
Resolves SECRT-2157
This commit is contained in:
@@ -61,13 +61,15 @@ export const SelectWidget = (props: WidgetProps) => {
|
||||
hideLabel={true}
|
||||
disabled={disabled || readonly}
|
||||
size={selectSize as any}
|
||||
value={value ?? ""}
|
||||
value={value || undefined}
|
||||
onValueChange={onChange}
|
||||
options={
|
||||
enumOptions?.map((option: any) => ({
|
||||
value: option.value,
|
||||
label: option.label,
|
||||
})) || []
|
||||
enumOptions
|
||||
?.filter((option: any) => option.value !== "")
|
||||
.map((option: any) => ({
|
||||
value: option.value,
|
||||
label: option.label,
|
||||
})) || []
|
||||
}
|
||||
wrapperClassName="!mb-0 "
|
||||
className={className}
|
||||
|
||||
Reference in New Issue
Block a user