diff --git a/packages/twenty-front/src/modules/apollo/optimistic-effect/utils/triggerDestroyRecordsOptimisticEffect.ts b/packages/twenty-front/src/modules/apollo/optimistic-effect/utils/triggerDestroyRecordsOptimisticEffect.ts index 828d63a9bbb7..9821d5467382 100644 --- a/packages/twenty-front/src/modules/apollo/optimistic-effect/utils/triggerDestroyRecordsOptimisticEffect.ts +++ b/packages/twenty-front/src/modules/apollo/optimistic-effect/utils/triggerDestroyRecordsOptimisticEffect.ts @@ -4,7 +4,7 @@ import { triggerUpdateRelationsOptimisticEffect } from '@/apollo/optimistic-effe import { ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; import { RecordGqlRefEdge } from '@/object-record/cache/types/RecordGqlRefEdge'; import { isObjectRecordConnectionWithRefs } from '@/object-record/cache/utils/isObjectRecordConnectionWithRefs'; -import { ObjectRecord } from '@/object-record/types/ObjectRecord'; +import { RecordGqlNode } from '@/object-record/graphql/types/RecordGqlNode'; import { isDefined } from '~/utils/isDefined'; export const triggerDestroyRecordsOptimisticEffect = ({ @@ -16,7 +16,7 @@ export const triggerDestroyRecordsOptimisticEffect = ({ cache: ApolloCache; objectMetadataItem: ObjectMetadataItem; // TODO refactor this should consume RecordObject[] - recordsToDestroy: ObjectRecord[]; + recordsToDestroy: RecordGqlNode[]; objectMetadataItems: ObjectMetadataItem[]; }) => { cache.modify({ diff --git a/packages/twenty-front/src/modules/apollo/optimistic-effect/utils/triggerUpdateRelationsOptimisticEffect.ts b/packages/twenty-front/src/modules/apollo/optimistic-effect/utils/triggerUpdateRelationsOptimisticEffect.ts index 4005f1c18780..b91faa5ea7cc 100644 --- a/packages/twenty-front/src/modules/apollo/optimistic-effect/utils/triggerUpdateRelationsOptimisticEffect.ts +++ b/packages/twenty-front/src/modules/apollo/optimistic-effect/utils/triggerUpdateRelationsOptimisticEffect.ts @@ -31,6 +31,7 @@ export const triggerUpdateRelationsOptimisticEffect = ({ updatedSourceRecord, objectMetadataItems, }: triggerUpdateRelationsOptimisticEffectArgs) => { + console.log({currentSourceRecord, updatedSourceRecord}) return sourceObjectMetadataItem.fields.forEach( (fieldMetadataItemOnSourceRecord) => { const notARelationField = @@ -95,9 +96,11 @@ export const triggerUpdateRelationsOptimisticEffect = ({ } if (isObjectRecordConnection(relationDefinition, value)) { + // Might not be a good idea to return RecordObject here as they might be written in cache later return getRecordsFromRecordConnection({recordConnection: value}) } + // Might not be a good idea to return RecordObject here as they might be written in cache later return [getRecordFromRecordNode({recordNode: value})]; }; const targetRecordsToDetachFrom = extractTargetRecordsFromRelation(