Skip to content

Commit 875dae2

Browse files
authored
fix: Bitness type in dropdown (#6614)
1 parent 26d21fe commit 875dae2

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

components/Downloads/Release/BitnessDropdown.tsx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,21 +63,27 @@ const BitnessDropdown: FC = () => {
6363
// this can be an optimisation for the future
6464
// to remove this logic from this component
6565
useEffect(() => {
66-
const mappedBittnessesValues = bitnessItems[os].map(({ value }) => value);
66+
const mappedBitnessValues = bitnessItems[os].map(({ value }) => value);
6767

68-
const currentBittnessExcluded =
68+
const currentBitnessExcluded =
6969
// Different OSs support different Bitnessess, hence we should also check
7070
// if besides the current bitness not being supported for a given release version
7171
// we also should check if it is not supported by the OS
7272
disabledItems.includes(String(bitness)) ||
73-
!mappedBittnessesValues.includes(String(bitness));
73+
!mappedBitnessValues.includes(String(bitness));
7474

75-
const nonExcludedBitness = mappedBittnessesValues.find(
76-
bittness => !disabledItems.includes(bittness)
75+
const nonExcludedBitness = mappedBitnessValues.find(
76+
bitness => !disabledItems.includes(bitness)
7777
);
7878

79-
if (currentBittnessExcluded && nonExcludedBitness) {
80-
setBitness(nonExcludedBitness);
79+
if (currentBitnessExcluded && nonExcludedBitness) {
80+
// We set it as a Number for cases where it is 64 or 86 otherwise we are
81+
// setting it as a string (ARMv7, ARMv6, etc.)
82+
if (Number.isNaN(Number(nonExcludedBitness)) === false) {
83+
setBitness(Number(nonExcludedBitness));
84+
} else {
85+
setBitness(nonExcludedBitness);
86+
}
8187
}
8288
// we shouldn't react when "actions" change
8389
// eslint-disable-next-line react-hooks/exhaustive-deps

0 commit comments

Comments
 (0)