Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix support custom object renaming #8089

Merged
merged 3 commits into from
Oct 27, 2024
Merged

Conversation

ijreilly
Copy link
Collaborator

In this PR

  1. (FE) fixing update of name not taken into account if toggle value is changed in the same transaction
  2. (BE) moving same nameSingular and namePlural validation before effective update

@ijreilly ijreilly requested a review from Weiko October 26, 2024 10:07
Copy link
Member

@Weiko Weiko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM @ijreilly, thank you for the quick fix. I left some comments that can be addressed in another PR

@@ -102,6 +102,8 @@ const StyledLabel = styled.span`

const infoCircleElementId = 'info-circle-id';

export const IS_LABEL_SYNCED_WITH_NAME_LABEL = 'isLabelSyncedWithName';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export const IS_LABEL_SYNCED_WITH_NAME_LABEL = 'isLabelSyncedWithName';
export const IS_LABEL_SYNCED_WITH_NAME = 'isLabelSyncedWithName';

const shouldComputeNamesFromLabels: boolean = dirtyFieldKeys.includes(
IS_LABEL_SYNCED_WITH_NAME_LABEL,
)
? (formValues.isLabelSyncedWithName as boolean)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
? (formValues.isLabelSyncedWithName as boolean)
? !!formValues.isLabelSyncedWithName

or

Suggested change
? (formValues.isLabelSyncedWithName as boolean)
? (formValues.isLabelSyncedWithName ?? false)

would be better than type assertion imho

@@ -16,6 +16,7 @@ import { RecordFieldValueSelectorContextProvider } from '@/object-record/record-
import { SaveAndCancelButtons } from '@/settings/components/SaveAndCancelButtons/SaveAndCancelButtons';
import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';
import {
IS_LABEL_SYNCED_WITH_NAME_LABEL,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not 100% sure this const should be specifically owned by this component? Should we move to a constants folder instead?

@Weiko Weiko merged commit a72f51a into main Oct 27, 2024
18 checks passed
@Weiko Weiko deleted the fix-support-custom-object-renaming branch October 27, 2024 13:56
@@ -1641,4 +1635,18 @@ export class ObjectMetadataService extends TypeOrmQueryService<ObjectMetadataEnt
);
}
};

private validateNameSingularAndNamePluralAreDifferentOrThrow = (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could reuse this in the create

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants