From 69f052e3ad59adf5fc91f26b48a36575d275a0df Mon Sep 17 00:00:00 2001 From: Charles Bochet Date: Sat, 30 Nov 2024 10:48:43 +0100 Subject: [PATCH] Fix activity target picker (#8812) This PR is fixing the Task/Note Target picker. ## Issue A few weeks ago, we have simplified the recordPicker logic. During this refacto, we stopped making sure the selected records were fetched. However, the optimistic update of the activity supposed that current activityTargets are present in the selection in the picker in order to filter out the removed items. ## Fix In case we don't find the record in the picker selection, we don't filter it out (it means the user cannot have removed it) ## Next step @ijreilly I think we should put it back, as the selected records do not appear on top anymore --- .../components/ActivityTargetInlineCellEditMode.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/twenty-front/src/modules/activities/inline-cell/components/ActivityTargetInlineCellEditMode.tsx b/packages/twenty-front/src/modules/activities/inline-cell/components/ActivityTargetInlineCellEditMode.tsx index f85dc54adfc3..a7a8b486ce98 100644 --- a/packages/twenty-front/src/modules/activities/inline-cell/components/ActivityTargetInlineCellEditMode.tsx +++ b/packages/twenty-front/src/modules/activities/inline-cell/components/ActivityTargetInlineCellEditMode.tsx @@ -98,7 +98,7 @@ export const ActivityTargetInlineCellEditMode = ({ async () => { const activityTargetsAfterUpdate = activityTargetWithTargetRecords.filter((activityTarget) => { - const record = snapshot + const recordSelectedInMultiSelect = snapshot .getLoadable( objectRecordMultiSelectComponentFamilyState({ scopeId: recordPickerInstanceId, @@ -107,7 +107,9 @@ export const ActivityTargetInlineCellEditMode = ({ ) .getValue() as ObjectRecordAndSelected; - return record.selected; + return recordSelectedInMultiSelect + ? recordSelectedInMultiSelect.selected + : true; }); setActivityFromStore((currentActivity) => { if (isNull(currentActivity)) {