File tree Expand file tree Collapse file tree 1 file changed +9
-10
lines changed
Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -463,28 +463,27 @@ const UserWidget: VtexFunctionComponent<UserWidgetProps> = ({
463463
464464 const handleSearchOrganizations = ( e : any ) => {
465465 const { value } : { value : string } = e . target
466- let dataList
466+ let dataList ;
467467
468468 setSearchTerm ( e . target . value )
469469
470470 dataList = userWidgetData ?. getActiveOrganizationsByEmail ?. sort (
471471 sortOrganizations
472472 )
473-
474473 if ( value . trim ( ) !== '' ) {
475474 dataList =
476475 userWidgetData ?. getActiveOrganizationsByEmail
477476 ?. filter ( ( organization : any ) => {
477+ const organizationName = organization . organizationName ?. toLowerCase ( ) || '' ;
478+ const costCenterName = organization . costCenterName ?. toLowerCase ( ) || '' ;
479+ const searchValue = value . toLowerCase ( ) ;
480+
478481 return (
479- organization . organizationName
480- . toLowerCase ( )
481- . includes ( value . toLowerCase ( ) ) ||
482- organization . costCenterName
483- . toLowerCase ( )
484- . includes ( value . toLowerCase ( ) )
485- )
482+ organizationName . includes ( searchValue ) ||
483+ costCenterName . includes ( searchValue )
484+ ) ;
486485 } )
487- ?. slice ( 0 , 15 ) ?? [ ]
486+ ?. slice ( 0 , 15 ) ?? [ ] ;
488487 }
489488
490489 setOrganizationsState ( {
You can’t perform that action at this time.
0 commit comments