File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed
frontends/web/src/routes/market/components Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,6 @@ import { SingleValue } from 'react-select';
1919import { useDarkmode } from '@/hooks/darkmode' ;
2020import { Dropdown } from '@/components/dropdown/dropdown' ;
2121import { GlobeDark , GlobeLight } from '@/components/icon' ;
22- import { i18n } from '@/i18n/i18n' ;
2322import styles from './countryselect.module.css' ;
2423
2524export type TOption = {
@@ -59,13 +58,12 @@ const Option = ({ props }: {props: TOption}) => {
5958
6059const CountrySelect = ( { onChangeRegion, regions, selectedRegion } : TProps ) => {
6160 const { t } = useTranslation ( ) ;
62- let selectedRegionName = t ( 'buy.exchange.selectRegion' ) ;
63- if ( selectedRegion ) {
64- selectedRegionName = new Intl . DisplayNames ( [ i18n . language ] , { type : 'region' } ) . of ( selectedRegion ) || '' ;
65- }
61+
62+ // find and pass the default object, react-select requires object identity matching, not just value equality
63+ const defaultValue = regions . find ( region => region . value === selectedRegion ) ;
6664 return (
6765 < Dropdown
68- defaultValue = { { label : selectedRegionName , value : selectedRegion } }
66+ value = { defaultValue }
6967 className = { styles . select }
7068 renderOptions = { ( o ) => < Option props = { o } /> }
7169 isSearchable = { true }
You can’t perform that action at this time.
0 commit comments