@@ -42,36 +42,28 @@ export const LocationSelector: React.FC<LocationSelectorProps> = ({
4242 } ;
4343
4444 const items = useMemo ( ( ) => {
45- const filtered = locations
46- . filter ( ( loc ) => loc . resource . name ?. toLowerCase ( ) . startsWith ( searchTerm . toLowerCase ( ) ) )
47- . map ( ( loc ) => ( {
48- id : loc . resource . id ,
49- name : loc . resource . name ,
50- } ) ) ;
45+ const filtered = locations . map ( ( loc ) => ( {
46+ id : loc . resource . id ,
47+ name : loc . resource . name ,
48+ } ) ) ;
5149 return filtered ;
5250 } , [ locations , searchTerm ] ) ;
5351
5452 return (
5553 < section data-testid = "combo" >
5654 < div className = { styles . sectionTitle } > { Locationlabel } </ div >
5755 < div >
58- { locations . length ? (
59- < ComboBox
60- aria-label = { comBoxLabel }
61- id = "location"
62- invalidText = { 'Required' }
63- items = { items }
64- itemToString = { ( item ) => item ?. name || '' }
65- selectedItem = { items . find ( ( item ) => item . id === selectedLocationUuid ) }
66- onChange = { ( { selectedItem } ) => onChange ( selectedItem ?. id ) }
67- onInputChange = { ( searchTerm ) => handleSearch ( searchTerm ) }
68- titleText = { comBoxLabel }
69- />
70- ) : (
71- < div className = { styles . emptyState } >
72- < p className = { styles . locationNotFound } > { t ( 'noResultsToDisplay' , 'No results to display' ) } </ p >
73- </ div >
74- ) }
56+ < ComboBox
57+ aria-label = { comBoxLabel }
58+ id = "location"
59+ invalidText = { 'Required' }
60+ items = { items }
61+ itemToString = { ( item ) => item ?. name || '' }
62+ selectedItem = { items . find ( ( item ) => item . id === selectedLocationUuid ) }
63+ onChange = { ( { selectedItem } ) => onChange ( selectedItem ?. id ) }
64+ onInputChange = { ( searchTerm ) => handleSearch ( searchTerm ) }
65+ titleText = { comBoxLabel }
66+ />
7567 </ div >
7668 </ section >
7769 ) ;
0 commit comments