diff --git a/frontend/public/components/cluster-settings/cluster-settings.tsx b/frontend/public/components/cluster-settings/cluster-settings.tsx index c8b9f7ee7b6..ebfb2f9fad8 100644 --- a/frontend/public/components/cluster-settings/cluster-settings.tsx +++ b/frontend/public/components/cluster-settings/cluster-settings.tsx @@ -401,7 +401,7 @@ export const CurrentVersion: React.FC = ({ cv }) => { {lastVersion} - + ) : ( <>{t('public~None')} @@ -751,9 +751,8 @@ export const UpdatesGraph: React.FC = ({ cv }) => { const availableUpdates = getSortedAvailableUpdates(cv); const lastVersion = getLastCompletedUpdate(cv); const newestVersion = availableUpdates[0]?.version; - const minorVersionIsNewer = newestVersion - ? isMinorVersionNewer(lastVersion, newestVersion) - : false; + const minorVersionIsNewer = + lastVersion && newestVersion ? isMinorVersionNewer(lastVersion, newestVersion) : false; const secondNewestVersion = availableUpdates[1]?.version; const currentChannel = cv.spec.channel; const currentPrefix = splitClusterVersionChannel(currentChannel)?.prefix; diff --git a/frontend/public/module/k8s/cluster-settings.ts b/frontend/public/module/k8s/cluster-settings.ts index d328c994116..31dbd4d69df 100644 --- a/frontend/public/module/k8s/cluster-settings.ts +++ b/frontend/public/module/k8s/cluster-settings.ts @@ -78,6 +78,9 @@ export const getSortedNotRecommendedUpdates = (cv: ClusterVersionKind): Conditio export const getNewerMinorVersionUpdate = (currentVersion, availableUpdates) => { const currentVersionParsed = semver.parse(currentVersion); + if (!currentVersionParsed) { + return; + } return availableUpdates?.find( // find the next minor version update, which there should never be more than one (update) => { @@ -94,8 +97,8 @@ export const isMinorVersionNewer = (currentVersion, otherVersion) => { const currentVersionParsed = semver.parse(currentVersion); const otherVersionParsed = semver.parse(otherVersion); return semver.gt( - semver.coerce(`${otherVersionParsed.major}.${otherVersionParsed.minor}`), - semver.coerce(`${currentVersionParsed.major}.${currentVersionParsed.minor}`), + semver.coerce(`${otherVersionParsed?.major}.${otherVersionParsed?.minor}`), + semver.coerce(`${currentVersionParsed?.major}.${currentVersionParsed?.minor}`), ); };