Skip to content

Commit c8e604f

Browse files
authored
fix: compatibility engine should run even on initial state (#7366)
1 parent fa9d844 commit c8e604f

File tree

5 files changed

+12
-13
lines changed

5 files changed

+12
-13
lines changed

apps/site/components/Downloads/Release/OperatingSystemDropdown.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ const OperatingSystemDropdown: FC<OperatingSystemDropdownProps> = () => {
3030
// We parse the compatibility of the dropdown items
3131
const parsedOperatingSystems = useMemo(
3232
() => parseCompat(OPERATING_SYSTEMS, release),
33-
// We only want to react on the change of the OS, Bitness, and Version
33+
// We only want to react on the change of the Install Method
3434
// eslint-disable-next-line react-hooks/exhaustive-deps
35-
[release.os, release.platform, release.version]
35+
[release.installMethod, release.os]
3636
);
3737

3838
return (

apps/site/components/Downloads/Release/PackageManagerDropdown.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const PackageManagerDropdown: FC = () => {
3030
),
3131
// We only want to react on the change of the Version
3232
// eslint-disable-next-line react-hooks/exhaustive-deps
33-
[release.version]
33+
[release.version, release.packageManager]
3434
);
3535

3636
return (

apps/site/components/Downloads/Release/PlatformDropdown.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const PlatformDropdown: FC = () => {
4040
: [],
4141
// We only want to react on the change of the OS, Platform, and Version
4242
// eslint-disable-next-line react-hooks/exhaustive-deps
43-
[release.os, release.platform, release.version]
43+
[release.os, release.version]
4444
);
4545

4646
// We set the Platform to the next available Architecture when the current

apps/site/components/Downloads/Release/PrebuiltDownloadButtons.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const PrebuiltDownloadButtons: FC = () => {
3030
: '';
3131

3232
return (
33-
<div className="my-4 flex gap-2">
33+
<div className="my-4 flex flex-wrap gap-2">
3434
<Skeleton
3535
loading={os === 'LOADING' || platform === ''}
3636
hide={OS_NOT_SUPPORTING_INSTALLERS.includes(os)}

apps/site/util/downloadUtils.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ export enum PackageManagerLabel {
4242
}
4343

4444
type DownloadCompatibility = {
45-
os: Array<UserOS>;
46-
installMethod: Array<Types.InstallationMethod>;
47-
platform: Array<UserPlatform>;
45+
os: Array<UserOS | 'LOADING'>;
46+
installMethod: Array<Types.InstallationMethod | ''>;
47+
platform: Array<UserPlatform | ''>;
4848
semver: Array<string>;
4949
releases: Array<NodeReleaseStatus>;
5050
};
@@ -97,14 +97,13 @@ export const parseCompat = <
9797
): Array<T> => {
9898
const satisfiesSemver = (semver: string) => satisfies(version, semver);
9999

100-
const supportsOS = (i: T['compatibility']) =>
101-
os === 'LOADING' || (i.os?.includes(os) ?? true);
100+
const supportsOS = (i: T['compatibility']) => i.os?.includes(os) ?? true;
102101

103102
const supportsInstallMethod = (i: T['compatibility']) =>
104-
(installMethod === '' || i.installMethod?.includes(installMethod)) ?? true;
103+
i.installMethod?.includes(installMethod) ?? true;
105104

106105
const supportsPlatform = (i: T['compatibility']) =>
107-
platform === '' || (i.platform?.includes(platform) ?? true);
106+
i.platform?.includes(platform) ?? true;
108107

109108
const supportsVersion = (i: T['compatibility']) =>
110109
i.semver?.some(satisfiesSemver) ?? true;
@@ -145,7 +144,7 @@ export const OPERATING_SYSTEMS: Array<DownloadDropdownItem<UserOS>> = [
145144
{
146145
label: OperatingSystemLabel.AIX,
147146
value: 'AIX',
148-
compatibility: { installMethod: [] },
147+
compatibility: { installMethod: [''] },
149148
iconImage: <OSIcons.AIX width={16} height={16} />,
150149
},
151150
];

0 commit comments

Comments
 (0)