File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change 3
3
* user selects the component. It encapsulates the search filter, the
4
4
* Select-all item, and the list of options.
5
5
*/
6
- import React , {
6
+ import React , {
7
7
useCallback ,
8
8
useEffect ,
9
9
useMemo ,
@@ -177,10 +177,10 @@ const SelectPanel = () => {
177
177
const creationRef : any = useRef ( ) ;
178
178
useKey ( [ KEY . ENTER ] , handleOnCreateOption , { target : creationRef } ) ;
179
179
180
- const canCreatableAppear =
180
+ const showCratable =
181
181
isCreatable &&
182
182
searchText &&
183
- ! filteredOptions . some ( ( e ) => e . value + "" === searchText ) ;
183
+ ! filteredOptions . some ( ( e ) => e ? .value === searchText ) ;
184
184
185
185
return (
186
186
< div className = "select-panel" role = "listbox" ref = { listRef } >
@@ -227,11 +227,7 @@ const SelectPanel = () => {
227
227
options = { filteredOptions }
228
228
onClick = { ( _e , index ) => handleItemClicked ( index ) }
229
229
/>
230
- ) : canCreatableAppear ? null : (
231
- < li className = "no-options" > { t ( "noOptions" ) } </ li >
232
- ) }
233
-
234
- { canCreatableAppear && (
230
+ ) : showCratable ? (
235
231
< li
236
232
onClick = { handleOnCreateOption }
237
233
className = "select-item creatable"
@@ -240,6 +236,8 @@ const SelectPanel = () => {
240
236
>
241
237
{ `${ t ( "create" ) } "${ searchText } "` }
242
238
</ li >
239
+ ) : (
240
+ < li className = "no-options" > { t ( "noOptions" ) } </ li >
243
241
) }
244
242
</ ul >
245
243
</ div >
You can’t perform that action at this time.
0 commit comments