-
Notifications
You must be signed in to change notification settings - Fork 53
Custom Domain: Allow updating domains for existing sites. #1064
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
Conversation
2c7503d to
c1eb800
Compare
|
Can I get some reviews here? |
bcotrim
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great feature!
Added some comments, but overall I think this looks great!
Something I noticed during my tests:
- Having an invalid domain disables the submit, even when "Use custom domain" isn't checked. I recorded on "Edit Site" but the same behavior happens on "Add Site":
Screen.Recording.2025-03-19.at.18.28.37.mov
src/lib/hosts-file.ts
Outdated
| } | ||
| }; | ||
|
|
||
| export const replaceDomainInHosts = async ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rename this function as it handles all possible domain change scenarios.
And to keep the format consistent, move the replacing logic to its own replaceDomainInHosts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I understand this comment fully but I renamed the function.
| ( selectedSite?.phpVersion as AllowedPHPVersion ) ?? DEFAULT_PHP_VERSION | ||
| ); | ||
| const [ selectedWpVersion, setSelectedWpVersion ] = useState( currentWpVersion ); | ||
| const [ useCustomDomain, setUseCustomDomain ] = useState( Boolean( selectedSite?.customDomain ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems a lot of this logic is very similar to the one we added to site-form
I believe there's an opportunity here to create a shared component/hook, to avoid repetition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Entirely agree but this is not new. The way the form works today is not great and would deserve a refactor but it's not a small change.
|
I fixed the validation bug. |
bcotrim
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making the changes.
I added a small comment, but it shouldn't be blocking.
I noticed the custom domain error message get cut when we display multiple errors.
This should be fixed with this change but something to re-test later.
@bcotrim I tested it when I rebased #1078 and noticed it is fixed in Add Site, but it still happens in Edit Site. Are you also reproduce it there? |
I don't see it happening on "Add Site" or "Edit Site". Screen.Recording.2025-03-21.at.10.01.25.mov |
Oh, it was that. Thanks for clarifying. When I edit the site name, then enable a custom domain and enter an invalid one, Save button toggles correctly when I keep disabling and enabling a custom domain. |

Related issues
Summary
Testing instructions