remove activity fallback record in RelationFromManyFieldDisplay (#12232)

EDITED ⬇️ 

Context
When fixing relation fields preview in this
[PR](https://github.com/twentyhq/twenty/pull/11745/files#diff-10073c6310707810d002bceef587936ed5d31dba2ea5babbb4d452a7f1e756b5R31-R35),
I've (try to) fixed NoteTarget (and TaskTarget) field preview adding
[fallback
record](https://github.com/twentyhq/twenty/pull/11745/files#diff-da3ccb70824f1792351457dbee66dd75e48e45ff8e6e0f768f402e35256377bcR54-R61).

It introduces the sentry error (findOneNote/Task with 'fallback-id') :
when activity is soft deleted, associated activityTarget is not. In
TableView, when displaying Note/Task field in view for a record with a
soft deleted ntoe/task, 'fallback-id' record chip is clickable.

Solution - seen with Charles - Remove fallback-id record + Hide
NoteTarget and TaskTarget field preview - awaiting ManyToMany relation
are updated in few weeks

<img width="1160" alt="Screenshot 2025-05-23 at 11 07 06"
src="https://github.com/user-attachments/assets/73b1629a-67a0-43cc-ac2c-ddeea524ed6e"
/>


Test - RelationFromManyFieldDisplay in Table view & Settings field
preview

closes https://github.com/twentyhq/twenty/issues/12218
This commit is contained in:
Etienne
2025-05-23 12:25:12 +02:00
committed by GitHub
parent ddab513c0b
commit 3d21e1ce26
2 changed files with 29 additions and 34 deletions

View File

@ -10,7 +10,6 @@ import { useRelationFromManyFieldDisplay } from '@/object-record/record-field/me
import { ExpandableList } from '@/ui/layout/expandable-list/components/ExpandableList';
import { useContext } from 'react';
import { isDefined } from 'twenty-shared/utils';
import { pascalCase } from '~/utils/string/pascalCase';
export const RelationFromManyFieldDisplay = () => {
const { fieldValue, fieldDefinition, generateRecordChipData } =
@ -51,28 +50,14 @@ export const RelationFromManyFieldDisplay = () => {
: CoreObjectNameSingular.Task;
const relationFieldName = fieldName === 'noteTargets' ? 'note' : 'task';
const formattedRecords = fieldValue.map((record) => {
if (!isDefined(record[relationFieldName])) {
return {
...record,
[relationFieldName]: {
id: 'fallback-id',
title: pascalCase(relationFieldName),
},
};
}
return record;
});
return (
<ExpandableList isChipCountDisplayed={isFocused}>
{formattedRecords
{fieldValue
.map((record) => {
if (!isDefined(record)) {
if (!isDefined(record) || !isDefined(record[relationFieldName])) {
return undefined;
}
return (
<RecordChip
key={record.id}