Skip to content

Commit e9a85ee

Browse files
committed
πŸ›(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.
1 parent a343db2 commit e9a85ee

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@openfun/cunningham-react": patch
3+
---
4+
5+
prevent error on searchable select

β€Žpackages/react/src/components/Forms/Select/multi-searchable.tsxβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export const SelectMultiSearchable = ({ ref, ...props }: SubProps) => {
7676
break;
7777
}
7878
},
79-
isItemDisabled: (item) => !!item.disabled,
79+
isItemDisabled: (item) => !!item?.disabled,
8080
});
8181

8282
const inputProps = downshiftReturn.getInputProps({

β€Žpackages/react/src/components/Forms/Select/multi-simple.tsxβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export const SelectMultiSimple = ({ ref, ...props }: SubProps) => {
8888
break;
8989
}
9090
},
91-
isItemDisabled: (item) => !!item.disabled,
91+
isItemDisabled: (item) => !!item?.disabled,
9292
});
9393

9494
const toggleRef = useRef<HTMLElement>(null);

0 commit comments

Comments
Β (0)