Skip to content

[Permissions] Force open title input for role label when empty #12710

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

Merged
merged 1 commit into from
Jun 24, 2025

Conversation

Weiko
Copy link
Member

@Weiko Weiko commented Jun 18, 2025

  • Fix empty title in breadcrumb
  • Enforce role label input open if empty

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

Introduces Recoil-based state management for title inputs with enforced open state for empty role labels, improving UX and consistency across the application.

  • Added new titleInputComponentState with instance isolation using Recoil, replacing local React state in TitleInput.tsx
  • Created SettingsRoleLabelContainerEffect to enforce open state for empty role labels, following side-effect pattern
  • Standardized empty role label placeholder text to 'Untitled Role' across components
  • Added unique instanceId prop requirement for TitleInput components to support isolated state management

10 files reviewed, 2 comments
Edit PR Review Bot Settings | Greptile

isTitleInputOpen,
]);

return <></>;
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Empty fragment not needed since this is an effect component, use null instead

@Weiko Weiko requested a review from charlesBochet June 19, 2025 08:07
@prastoin prastoin self-requested a review June 19, 2025 12:42
Copy link
Contributor

@prastoin prastoin left a comment

Choose a reason for hiding this comment

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

Nice job ! About to test locally

);

useEffect(() => {
if (settingsDraftRole.label === '' && !isTitleInputOpen) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Subjectives thoughts/questions: Could the user insert an empty string ? From my understanding this assertion aims to compare if the current value is the default one ?
Would it makes sense for you to do such a thing ?

// packages/twenty-front/src/modules/settings/roles/states/settingsDraftRoleFamilyState.ts
export const settingsDraftRoleFamilyStateDefaultValue ={
    id: '',
    label: '',
    description: '',
    icon: '',
    canDestroyAllObjectRecords: false,
    canReadAllObjectRecords: false,
    canSoftDeleteAllObjectRecords: false,
    canUpdateAllObjectRecords: false,
    canUpdateAllSettings: false,
    isEditable: false,
    workspaceMembers: [],
    settingPermissions: [],
    objectPermissions: [],
} as const
export const settingsDraftRoleFamilyState = createFamilyState<Role, string>({
  key: 'settingsDraftRoleFamilyState',
  defaultValue: settingsDraftRoleFamilyStateDefaultValue
});

// packages/twenty-front/src/modules/settings/roles/role/components/SettingsRole.tsx
if (settingsDraftRole.label === settingsDraftRoleFamilyStateDefaultValue.label && !isTitleInputOpen) {

@@ -288,14 +299,19 @@ export const SettingsRole = ({ roleId, isCreateMode }: SettingsRoleProps) => {
href: getSettingsPath(SettingsPath.Roles),
},
{
children: settingsDraftRole.label,
children:
isDefined(settingsDraftRole.label) &&
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: Unless I'm mistaken could use isNonEmptyString

@prastoin
Copy link
Contributor

Remarks

While testing locally I encountered two "weird' behaviors. The role label enforcement prevents:

  • To send the form but it seems like the form would be passing validation as the save CTA is active ( tho on the video no http request is performed from it being clicked )
Screen.Recording.2025-06-19.at.15.26.29.mov
  • It takes precedance over other form inputs from same and other tabs ( description see above video )
Screen.Recording.2025-06-19.at.15.29.32.mov

@charlesBochet charlesBochet merged commit 074cd22 into main Jun 24, 2025
57 of 61 checks passed
@charlesBochet charlesBochet deleted the c--force-open-role-label-input-when-empty branch June 24, 2025 12:06
Weiko added a commit that referenced this pull request Jun 24, 2025
abdulrahmancodes pushed a commit to abdulrahmancodes/twenty that referenced this pull request Jun 26, 2025
…yhq#12710)

- Fix empty title in breadcrumb 
- Enforce role label input open if empty
abdulrahmancodes pushed a commit to abdulrahmancodes/twenty that referenced this pull request Jun 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants