From 9c67a109afc223b647286ae4b0700b0fdfbb10a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Bosi?= <71827178+bosiraphael@users.noreply.github.com> Date: Fri, 6 Dec 2024 17:41:58 +0100 Subject: [PATCH] Fix SingleRecordSelectMenuItemsWithSearch (#8932) - Fix all fields being selected when opening dropdown - Fix not being able to set back to no selection when a record is selected and there is only one record to select Before: https://github.com/user-attachments/assets/31185a05-7e1a-4550-aa2a-591683934224 After: https://github.com/user-attachments/assets/e3cd388b-44de-42e2-970b-b4d4f31253bc --- .../SingleRecordSelectMenuItemsWithSearch.tsx | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/packages/twenty-front/src/modules/object-record/relation-picker/components/SingleRecordSelectMenuItemsWithSearch.tsx b/packages/twenty-front/src/modules/object-record/relation-picker/components/SingleRecordSelectMenuItemsWithSearch.tsx index 3952c88521..0066acad2b 100644 --- a/packages/twenty-front/src/modules/object-record/relation-picker/components/SingleRecordSelectMenuItemsWithSearch.tsx +++ b/packages/twenty-front/src/modules/object-record/relation-picker/components/SingleRecordSelectMenuItemsWithSearch.tsx @@ -59,6 +59,9 @@ export const SingleRecordSelectMenuItemsWithSearch = ({ /> ); + const shouldDisplayDropdownMenuItems = + records.recordsToSelect.length + records.selectedRecords?.length > 0; + return ( <> {dropdownPlacement?.includes('end') && ( @@ -67,15 +70,11 @@ export const SingleRecordSelectMenuItemsWithSearch = ({ {createNewButton} {records.recordsToSelect.length > 0 && } - {records.recordsToSelect.length > 0 && ( + {shouldDisplayDropdownMenuItems && ( - {records.recordsToSelect.length > 0 && ( + {shouldDisplayDropdownMenuItems && (