Fix object model settings label synchronization (#11708)

# Introduction
Closes https://github.com/twentyhq/twenty/issues/11150
This commit is contained in:
Paul Rastoin
2025-04-24 10:58:59 +02:00
committed by GitHub
parent ccc6d968aa
commit 0083569606

View File

@ -100,7 +100,9 @@ export const SettingsDataModelObjectAboutForm = ({
setValue('labelPlural', labelPluralFromSingularLabel, { setValue('labelPlural', labelPluralFromSingularLabel, {
shouldDirty: true, shouldDirty: true,
}); });
fillNamePluralFromLabelPlural(labelPluralFromSingularLabel); if (isLabelSyncedWithName) {
fillNamePluralFromLabelPlural(labelPluralFromSingularLabel);
}
}; };
const fillNameSingularFromLabelSingular = ( const fillNameSingularFromLabelSingular = (
@ -318,17 +320,19 @@ export const SettingsDataModelObjectAboutForm = ({
advancedMode advancedMode
onChange={(value) => { onChange={(value) => {
onChange(value); onChange(value);
onNewDirtyField?.(); const isCustomObject =
isDefined(objectMetadataItem) &&
objectMetadataItem.isCustom;
const isbeingCreatedObject =
!isDefined(objectMetadataItem);
if ( if (
value === true && value === true &&
((isDefined(objectMetadataItem) && (isCustomObject || isbeingCreatedObject)
objectMetadataItem.isCustom) ||
!isDefined(objectMetadataItem))
) { ) {
fillNamePluralFromLabelPlural(labelPlural); fillNamePluralFromLabelPlural(labelPlural);
fillNameSingularFromLabelSingular(labelSingular); fillNameSingularFromLabelSingular(labelSingular);
} }
onNewDirtyField?.();
}} }}
/> />
</Card> </Card>