Skip to content

Commit

Permalink
Fix activity target picker (#8812)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
charlesBochet authored Nov 30, 2024
1 parent b542b43 commit 69f052e
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export const ActivityTargetInlineCellEditMode = ({
async () => {
const activityTargetsAfterUpdate =
activityTargetWithTargetRecords.filter((activityTarget) => {
const record = snapshot
const recordSelectedInMultiSelect = snapshot
.getLoadable(
objectRecordMultiSelectComponentFamilyState({
scopeId: recordPickerInstanceId,
Expand All @@ -107,7 +107,9 @@ export const ActivityTargetInlineCellEditMode = ({
)
.getValue() as ObjectRecordAndSelected;

return record.selected;
return recordSelectedInMultiSelect
? recordSelectedInMultiSelect.selected
: true;
});
setActivityFromStore((currentActivity) => {
if (isNull(currentActivity)) {
Expand Down

0 comments on commit 69f052e

Please sign in to comment.