mirror of
https://github.com/keycloak/keycloak.git
synced 2026-01-25 16:42:34 +00:00
Handle options component with no value set.
Fixes #43244 Signed-off-by: Stan Silvert <ssilvert@redhat.com>
This commit is contained in:
@@ -37,15 +37,15 @@ export const OptionComponent = (props: UserProfileFieldProps) => {
|
||||
data-testid={option}
|
||||
label={label(props.t, optionLabel[option], option, prefix)}
|
||||
value={option}
|
||||
isChecked={field.value.includes(option)}
|
||||
isChecked={field.value?.includes(option)}
|
||||
onChange={() => {
|
||||
if (isMultiSelect) {
|
||||
if (field.value.includes(option)) {
|
||||
if (field.value?.includes(option)) {
|
||||
field.onChange(
|
||||
field.value.filter((item: string) => item !== option),
|
||||
field.value?.filter((item: string) => item !== option),
|
||||
);
|
||||
} else {
|
||||
field.onChange([...field.value, option]);
|
||||
field.onChange([...(field.value || []), option]);
|
||||
}
|
||||
} else {
|
||||
field.onChange([option]);
|
||||
|
||||
Reference in New Issue
Block a user