Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Reload custom domain list when add site modal opens
  • Loading branch information
fredrikekelund committed Mar 24, 2025
commit f7666fd1f7ea767aa1bf2490dffb226cf04fc7a0
3 changes: 3 additions & 0 deletions src/components/add-site.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export default function AddSite( { className }: AddSiteProps ) {
setCustomDomainError,
enableHttps,
setEnableHttps,
loadAllCustomDomains,
} = useAddSite();
const { importState } = useImportExport();

Expand Down Expand Up @@ -86,6 +87,7 @@ export default function AddSite( { className }: AddSiteProps ) {
setSitePath( '' );
setError( '' );
setDoesPathContainWordPress( isWordPress );
loadAllCustomDomains();
}, [
sites,
setSiteName,
Expand All @@ -95,6 +97,7 @@ export default function AddSite( { className }: AddSiteProps ) {
setDoesPathContainWordPress,
setWpVersion,
latestStableVersion,
loadAllCustomDomains,
] );

useEffect( () => {
Expand Down
2 changes: 2 additions & 0 deletions src/components/onboarding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export default function Onboarding() {
setCustomDomainError,
enableHttps,
setEnableHttps,
loadAllCustomDomains,
} = useAddSite();
const [ fileError, setFileError ] = useState( '' );

Expand Down Expand Up @@ -112,6 +113,7 @@ export default function Onboarding() {
setCustomDomain( null );
setCustomDomainError( '' );
setEnableHttps( false );
loadAllCustomDomains();
};
run();
// eslint-disable-next-line react-hooks/exhaustive-deps
Expand Down
4 changes: 3 additions & 1 deletion src/hooks/use-add-site.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function useAddSite() {
const [ existingDomainNames, setExistingDomainNames ] = useState< string[] >( [] );
const [ enableHttps, setEnableHttps ] = useState( false );

useEffect( () => {
const loadAllCustomDomains = useCallback( () => {
getIpcApi()
.getAllCustomDomains()
.then( ( domains ) => {
Expand Down Expand Up @@ -236,6 +236,7 @@ export function useAddSite() {
setCustomDomainError,
enableHttps,
setEnableHttps,
loadAllCustomDomains,
};
}, [
__,
Expand All @@ -261,5 +262,6 @@ export function useAddSite() {
setCustomDomainError,
enableHttps,
setEnableHttps,
loadAllCustomDomains,
] );
}