From ee8e223aed655ee2416b3d24f01894240a272665 Mon Sep 17 00:00:00 2001 From: Jagannath Samantra <120186101+Jagss24@users.noreply.github.com> Date: Sun, 6 Jul 2025 16:17:33 +0530 Subject: [PATCH] fix: fixed the update of field metadata label, icon & object (#13064) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR is raised to close the issue #13044 But there are some doubts that needs to be approved. If the fields are not custom then we were saving the changes in **standardOverrides** obj in which only three fields are overridableFields **label, icon & description** can be updated for a field. You can see this in _before-update-one-field.hook.ts_ on line 85 ```ts const overridableFields = ['label', 'icon', 'description']; ``` If the field to be updated are from these three we are putting this in a **standardOverrides** obj and passing it However in our _field-metadata.service.ts_ file. We have **updateOne** function inside it we have wrote a condition if **isCustom** is false then the purpose was to build the updatableFields from the **standardOverrides** obj that we got in **fieldMetadataInput** but there was an error in it. As you can see below ```ts const updatableFieldInput = existingFieldMetadata.isCustom === false ? this.buildUpdatableStandardFieldInput( fieldMetadataInput, existingFieldMetadata, ) : fieldMetadataInput; ``` However, the issue was that we were placing the entire **standardOverrides** object inside **updatableFieldInput** again — instead of merging its individual fields (label, icon, description) directly into the update payload. This PR fixes that by correctly applying the overrides into the top-level object. Please refer to the file changes for the full context. But the thing i don't know. [ ] - Is this the correct expected flow?? [ ]- Will this change break anything elsewhere? I still have doubts on these two. Let me know if I missed something. --------- Co-authored-by: Jagss24 Co-authored-by: Charles Bochet --- .../src/modules/object-record/hooks/useLazyFindManyRecords.ts | 3 ++- .../metadata-modules/field-metadata/field-metadata.service.ts | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/twenty-front/src/modules/object-record/hooks/useLazyFindManyRecords.ts b/packages/twenty-front/src/modules/object-record/hooks/useLazyFindManyRecords.ts index b89d5a07c..743d04f41 100644 --- a/packages/twenty-front/src/modules/object-record/hooks/useLazyFindManyRecords.ts +++ b/packages/twenty-front/src/modules/object-record/hooks/useLazyFindManyRecords.ts @@ -27,6 +27,7 @@ export const useLazyFindManyRecords = ({ orderBy, limit, recordGqlFields, + fetchPolicy = 'cache-first', }: UseLazyFindManyRecordsParams) => { const { objectMetadataItem } = useObjectMetadataItem({ objectNameSingular, @@ -68,7 +69,7 @@ export const useLazyFindManyRecords = ({ limit, orderBy, }, - fetchPolicy: 'cache-first', + fetchPolicy, onCompleted: handleFindManyRecordsCompleted, onError: handleFindManyRecordsError, client: apolloCoreClient, diff --git a/packages/twenty-server/src/engine/metadata-modules/field-metadata/field-metadata.service.ts b/packages/twenty-server/src/engine/metadata-modules/field-metadata/field-metadata.service.ts index 8c6cd1ea9..d35e46233 100644 --- a/packages/twenty-server/src/engine/metadata-modules/field-metadata/field-metadata.service.ts +++ b/packages/twenty-server/src/engine/metadata-modules/field-metadata/field-metadata.service.ts @@ -528,8 +528,7 @@ export class FieldMetadataService extends TypeOrmQueryService