@@ -73,7 +73,6 @@ const UserSearchField: React.FC<UserSearchFieldProps> = ({
7373 setLocalUsersData ( usersData || [ ] ) ;
7474 } , [ usersData ] ) ;
7575
76- // Combine current user with search results and filter appropriately
7776 const displayOptions = useMemo ( ( ) => {
7877 if ( hasInitialFocus && ! usersSearch && currentUserData ) {
7978 return [ currentUserData ] ;
@@ -159,23 +158,23 @@ const UserSearchField: React.FC<UserSearchFieldProps> = ({
159158 id = "user-search-field"
160159 style = { { width : '100%' } }
161160 open = { open }
161+ options = { displayOptions }
162+ getOptionLabel = { ( ) => inputValue }
163+ isOptionEqualToValue = { ( option , value ) => option . id === value . id }
162164 onOpen = { ( ) => setOpen ( true ) }
163165 onClose = { ( ) => setOpen ( false ) }
164166 inputValue = { inputValue }
165167 onChange = { handleAdd }
166168 onInputChange = { handleInputChange }
167- options = { displayOptions }
168- getOptionLabel = { ( ) => inputValue }
169- isOptionEqualToValue = { ( option , value ) => option . id === value . id }
170169 // eslint-disable-next-line @typescript-eslint/ban-ts-comment
171170 // @ts -ignore
172171 filterOptions = { ( options , { inputValue } ) => {
173172 return options . filter ( ( option : User ) => {
174173 const searchStr = inputValue . toLowerCase ( ) ;
175174 return (
176- option . first_name . toLowerCase ( ) . includes ( searchStr ) ||
177- option . last_name . toLowerCase ( ) . includes ( searchStr ) ||
178- option . email . toLowerCase ( ) . includes ( searchStr )
175+ option . first_name ? .toLowerCase ( ) . includes ( searchStr ) ||
176+ option . last_name ? .toLowerCase ( ) . includes ( searchStr ) ||
177+ option . email ? .toLowerCase ( ) . includes ( searchStr )
179178 ) ;
180179 } ) ;
181180 } }
@@ -187,6 +186,7 @@ const UserSearchField: React.FC<UserSearchFieldProps> = ({
187186 blurOnSelect = { true }
188187 clearOnBlur = { true }
189188 popupIcon = { null }
189+ forcePopupIcon = { false }
190190 noOptionsText = { isUserSearchLoading ? 'Loading...' : 'No users found' }
191191 renderInput = { ( params ) => (
192192 < TextField
@@ -199,7 +199,6 @@ const UserSearchField: React.FC<UserSearchFieldProps> = ({
199199 endAdornment : (
200200 < React . Fragment >
201201 { isUserSearchLoading ? < CircularProgress color = "inherit" size = { 20 } /> : null }
202- { params . InputProps . endAdornment }
203202 </ React . Fragment >
204203 )
205204 } }
@@ -307,12 +306,7 @@ const UserSearchField: React.FC<UserSearchFieldProps> = ({
307306 < Typography
308307 onClick = { ( ) => setShowAllUsers ( ! showAllUsers ) }
309308 sx = { {
310- cursor : 'pointer' ,
311- color : 'white' ,
312- fontWeight : '600' ,
313- '&:hover' : {
314- color : 'black'
315- }
309+ cursor : 'pointer'
316310 } }
317311 >
318312 { showAllUsers ? '(hide)' : `(+${ localUsersData . length - 1 } )` }
0 commit comments