@@ -9,18 +9,25 @@ import Select from '@/components/Common/Select';
99import { useDetectOS } from '@/hooks/react-client' ;
1010import { ReleaseContext } from '@/providers/releaseProvider' ;
1111import { bitnessItems , formatDropdownItems } from '@/util/downloadUtils' ;
12+ import { getUserBitnessByArchitecture } from '@/util/getUserBitnessByArchitecture' ;
1213
1314const parseNumericBitness = ( bitness : string ) =>
1415 / ^ \d + $ / . test ( bitness ) ? Number ( bitness ) : bitness ;
1516
1617const BitnessDropdown : FC = ( ) => {
17- const { bitness : userBitness } = useDetectOS ( ) ;
18+ const { bitness : userBitness , architecture : userArchitecture } =
19+ useDetectOS ( ) ;
1820 const { bitness, os, release, setBitness } = useContext ( ReleaseContext ) ;
1921 const t = useTranslations ( ) ;
2022
2123 // we also reset the bitness when the OS changes, because different OSs have
2224 // different bitnesses available
23- useEffect ( ( ) => setBitness ( userBitness ) , [ setBitness , userBitness ] ) ;
25+
26+ useEffect ( ( ) => {
27+ setBitness ( getUserBitnessByArchitecture ( userArchitecture , userBitness ) ) ;
28+ // we shouldn't update the effect on setter state change
29+ // eslint-disable-next-line react-hooks/exhaustive-deps
30+ } , [ userArchitecture , userBitness ] ) ;
2431
2532 // @TODO : We should have a proper utility that gives
2633 // disabled OSs, Platforms, based on specific criteria
0 commit comments