Skip to content

fix confirmation modal on subdomain settings #12845

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

ehconitin
Copy link
Contributor

before -

2025-06-24.20-37-10.mov

after -

2025-06-24.20-54-32.mov

@ehconitin ehconitin requested a review from AMoreaux June 24, 2025 15:26
@ehconitin ehconitin self-assigned this Jun 24, 2025
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

Fixed confirmation modal behavior in workspace subdomain settings to properly handle conflict scenarios and form submission structure.

  • Moved ConfirmationModal component outside the form element in packages/twenty-front/src/pages/settings/workspace/SettingsDomain.tsx to prevent form submission issues
  • Added closeModal from useModal hook to properly dismiss the modal when subdomain conflicts occur
  • Improved error handling flow by ensuring modal closes when domain validation fails

1 file reviewed, 1 comment
Edit PR Review Bot Settings | Greptile

Comment on lines +238 to +247
<ConfirmationModal
modalId={SUBDOMAIN_CHANGE_CONFIRMATION_MODAL_ID}
title={t`Change subdomain?`}
subtitle={t`You're about to change your workspace subdomain. This action will log out all users.`}
onConfirmClick={() => {
const values = form.getValues();
currentWorkspace &&
updateSubdomain(values.subdomain, currentWorkspace);
}}
/>
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Consider using early return in onConfirmClick to avoid using && operator for conditional execution. Better pattern would be:

Suggested change
<ConfirmationModal
modalId={SUBDOMAIN_CHANGE_CONFIRMATION_MODAL_ID}
title={t`Change subdomain?`}
subtitle={t`You're about to change your workspace subdomain. This action will log out all users.`}
onConfirmClick={() => {
const values = form.getValues();
currentWorkspace &&
updateSubdomain(values.subdomain, currentWorkspace);
}}
/>
onConfirmClick={() => {
const values = form.getValues();
if (!currentWorkspace) return;
updateSubdomain(values.subdomain, currentWorkspace);
}}

Copy link
Contributor

@AMoreaux AMoreaux left a comment

Choose a reason for hiding this comment

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

LGTM 👌

@ehconitin ehconitin enabled auto-merge (squash) June 24, 2025 15:32
@charlesBochet charlesBochet disabled auto-merge June 24, 2025 15:33
@charlesBochet charlesBochet merged commit d7c6806 into twentyhq:main Jun 24, 2025
51 checks passed
Copy link
Contributor

Thanks @ehconitin for your contribution!
This marks your 154th PR on the repo. You're top 1% of all our contributors 🎉
See contributor page - Share on LinkedIn - Share on Twitter

Contributions

Copy link
Contributor

🚀 Preview Environment Ready!

Your preview environment is available at: http://bore.pub:11015

This environment will automatically shut down when the PR is closed or after 5 hours.

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