🐛(react) prevent error on searchable select

When a select is searchable, when the user search term but this one return
no items, currently the component raise an error.
This commit is contained in:
jbpenrath
2025-05-05 18:13:30 +02:00
committed by Jean-Baptiste PENRATH
parent a343db2b0e
commit e9a85ee63f
3 changed files with 7 additions and 2 deletions

View File

@@ -0,0 +1,5 @@
---
"@openfun/cunningham-react": patch
---
prevent error on searchable select

View File

@@ -76,7 +76,7 @@ export const SelectMultiSearchable = ({ ref, ...props }: SubProps) => {
break;
}
},
isItemDisabled: (item) => !!item.disabled,
isItemDisabled: (item) => !!item?.disabled,
});
const inputProps = downshiftReturn.getInputProps({

View File

@@ -88,7 +88,7 @@ export const SelectMultiSimple = ({ ref, ...props }: SubProps) => {
break;
}
},
isItemDisabled: (item) => !!item.disabled,
isItemDisabled: (item) => !!item?.disabled,
});
const toggleRef = useRef<HTMLElement>(null);