1- import { type Region as RegionType } from '@logto/cloud/routes' ;
1+ import { type RegionResponse as RegionType } from '@logto/cloud/routes' ;
22import { Theme , TenantTag } from '@logto/schemas' ;
33import { condArray } from '@silverhand/essentials' ;
44import { useCallback , useMemo , useState } from 'react' ;
@@ -48,7 +48,7 @@ const getInstanceDropdownItems = (regions: RegionType[]): InstanceDropdownItemPr
4848 const hasPublicRegions = regions . some ( ( { isPrivate } ) => ! isPrivate ) ;
4949 const privateInstances = regions
5050 . filter ( ( { isPrivate } ) => isPrivate )
51- . map ( ( { id, name, country, tags } ) => ( { id, name, country, tags } ) ) ;
51+ . map ( ( { id, name, country, tags, displayName } ) => ( { id, name, country, tags, displayName } ) ) ;
5252
5353 return condArray ( hasPublicRegions && logtoDropdownItem , ...privateInstances ) ;
5454} ;
@@ -62,7 +62,7 @@ function CreateTenantModal({ isOpen, onClose }: Props) {
6262
6363 const defaultValues = Object . freeze ( {
6464 tag : TenantTag . Development ,
65- instanceId : logtoDropdownItem . id ,
65+ instanceId : logtoDropdownItem . name ,
6666 regionName : defaultRegionName ,
6767 } ) ;
6868 const methods = useForm < CreateTenantData > ( {
@@ -95,7 +95,7 @@ function CreateTenantModal({ isOpen, onClose }: Props) {
9595 [ regions ]
9696 ) ;
9797
98- const isLogtoInstance = instanceId === logtoDropdownItem . id ;
98+ const isLogtoInstance = instanceId === logtoDropdownItem . name ;
9999
100100 const currentRegion = useMemo ( ( ) => {
101101 if ( isDevFeaturesEnabled ) {
@@ -106,7 +106,7 @@ function CreateTenantModal({ isOpen, onClose }: Props) {
106106 return getRegionById ( regionName ) ;
107107 }
108108 // For private instances, find the region that matches the instance
109- return regions ?. find ( ( region ) => region . id === instanceId ) ;
109+ return regions ?. find ( ( region ) => region . name === instanceId ) ;
110110 } , [ isLogtoInstance , regionName , instanceId , getRegionById , regions ] ) ;
111111
112112 const getFinalRegionName = useCallback (
@@ -205,13 +205,13 @@ function CreateTenantModal({ isOpen, onClose }: Props) {
205205 < RadioGroup type = "plain" name = { name } value = { value } onChange = { onChange } >
206206 { regions . map ( ( region ) => (
207207 < Radio
208- key = { region . id }
208+ key = { region . name }
209209 title = {
210210 < DangerousRaw >
211211 < Region region = { region } />
212212 </ DangerousRaw >
213213 }
214- value = { region . id }
214+ value = { region . name }
215215 isDisabled = { isSubmitting }
216216 />
217217 ) ) }
@@ -264,13 +264,13 @@ function CreateTenantModal({ isOpen, onClose }: Props) {
264264 < RadioGroup type = "small" name = { name } value = { value } onChange = { onChange } >
265265 { publicRegions . map ( ( region ) => (
266266 < Radio
267- key = { region . id }
267+ key = { region . name }
268268 title = {
269269 < DangerousRaw >
270270 < Region region = { region } />
271271 </ DangerousRaw >
272272 }
273- value = { region . id }
273+ value = { region . name }
274274 isDisabled = { isSubmitting }
275275 />
276276 ) ) }
0 commit comments