diff --git a/src/front/Components/DesignSystem/SearchBar/index.tsx b/src/front/Components/DesignSystem/SearchBar/index.tsx index 7d4ccd32..9d7d8090 100644 --- a/src/front/Components/DesignSystem/SearchBar/index.tsx +++ b/src/front/Components/DesignSystem/SearchBar/index.tsx @@ -60,16 +60,10 @@ export default class SearchBar extends React.Component { const value = event.target.value.toLowerCase(); if (folder.office_folder_has_customers) { - const customersNames = folder.office_folder_has_customers?.reduce((acc: string[], customer) => { - return acc.concat( - `${customer.customer.contact.first_name.toLowerCase()} ${customer.customer.contact.last_name.toLowerCase()}`, - ); - }, []); - let namesIncludesValue = false; - customersNames.forEach((name) => { - if (name.includes(value)) namesIncludesValue = true; - }); - return name.includes(value) || number.includes(value) || namesIncludesValue; + const customerNames = folder.office_folder_has_customers.map((customer) => { + return `${customer.customer.contact.first_name.toLowerCase()} ${customer.customer.contact.last_name.toLowerCase()}`; + }).join(", "); + return name.includes(value) || number.includes(value) || customerNames.includes(value); } return name.includes(value) || number.includes(value);