fix: fixed the update of field metadata label, icon & object (#13064)
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 <btwitsjagannat12@gmail.com> Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
committed by
GitHub
parent
f65db49514
commit
ee8e223aed
@ -27,6 +27,7 @@ export const useLazyFindManyRecords = <T extends ObjectRecord = ObjectRecord>({
|
|||||||
orderBy,
|
orderBy,
|
||||||
limit,
|
limit,
|
||||||
recordGqlFields,
|
recordGqlFields,
|
||||||
|
fetchPolicy = 'cache-first',
|
||||||
}: UseLazyFindManyRecordsParams<T>) => {
|
}: UseLazyFindManyRecordsParams<T>) => {
|
||||||
const { objectMetadataItem } = useObjectMetadataItem({
|
const { objectMetadataItem } = useObjectMetadataItem({
|
||||||
objectNameSingular,
|
objectNameSingular,
|
||||||
@ -68,7 +69,7 @@ export const useLazyFindManyRecords = <T extends ObjectRecord = ObjectRecord>({
|
|||||||
limit,
|
limit,
|
||||||
orderBy,
|
orderBy,
|
||||||
},
|
},
|
||||||
fetchPolicy: 'cache-first',
|
fetchPolicy,
|
||||||
onCompleted: handleFindManyRecordsCompleted,
|
onCompleted: handleFindManyRecordsCompleted,
|
||||||
onError: handleFindManyRecordsError,
|
onError: handleFindManyRecordsError,
|
||||||
client: apolloCoreClient,
|
client: apolloCoreClient,
|
||||||
|
|||||||
@ -528,8 +528,7 @@ export class FieldMetadataService extends TypeOrmQueryService<FieldMetadataEntit
|
|||||||
|
|
||||||
if ('standardOverrides' in fieldMetadataInput) {
|
if ('standardOverrides' in fieldMetadataInput) {
|
||||||
updatableStandardFieldInput.standardOverrides =
|
updatableStandardFieldInput.standardOverrides =
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
fieldMetadataInput.standardOverrides as FieldStandardOverridesDTO;
|
||||||
(fieldMetadataInput as any).standardOverrides;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|||||||
Reference in New Issue
Block a user