Skip to content

Commit

Permalink
fix(APP-3384): Correctly identify OSx updates as latest version (#1382)
Browse files Browse the repository at this point in the history
  • Loading branch information
cgero-eth authored Jul 8, 2024
1 parent a9ec745 commit f94c066
Showing 1 changed file with 11 additions and 23 deletions.
34 changes: 11 additions & 23 deletions src/context/update.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,30 +169,18 @@ const UpdateProvider: React.FC<{children: ReactElement}> = ({children}) => {
useEffect(() => {
if (versions) {
const OSXVersions = new Map();
const versionKeys = Object.keys(SupportedVersions);

Object.keys(SupportedVersions).forEach(key => {
if (
compareVersions(
SupportedVersions[key as keyof typeof SupportedVersions],
versions.join('.')
) === 1
) {
OSXVersions.set(
SupportedVersions[key as keyof typeof SupportedVersions],
{
version: SupportedVersions[
key as keyof typeof SupportedVersions
] as string,
...(key === 'LATEST' && {isLatest: true}),
} as OSX
);

if (key === 'LATEST') {
setValue('osSelectedVersion', {
version: SupportedVersions[
key as keyof typeof SupportedVersions
] as string,
});
versionKeys.forEach((key, index) => {
const version =
SupportedVersions[key as keyof typeof SupportedVersions];
const isLatest = index === versionKeys.length - 1;

if (compareVersions(version, versions.join('.')) === 1) {
OSXVersions.set(version, {version, isLatest});

if (isLatest) {
setValue('osSelectedVersion', {version});
}
}
});
Expand Down

0 comments on commit f94c066

Please sign in to comment.