1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Fix chart upgrade screen by coercing the chart version to semver

Without that fix, I'm seeing such an errors when upgrading a chart:
```
semver.js:41 Uncaught (in promise) TypeError: Invalid Version: 1.9-dev
    at new A (semver.js:41)
    at Object.e.exports [as compare] (compare.js:3)
    at helm-chart.store.ts:37
    at Array.sort (<anonymous>)
    at QR.sortVersions (helm-chart.store.ts:36)
    at async QR.getVersions (helm-chart.store.ts:64)
    at async XD.loadVersions (upgrade-chart.tsx:57)
```

Signed-off-by: Marc Bachmann <marc.brookman@gmail.com>
This commit is contained in:
Marc Bachmann 2021-04-21 14:51:46 +02:00
parent 57a1612545
commit b9450fe1bd
No known key found for this signature in database
GPG Key ID: 001884E1441067E1

View File

@ -34,7 +34,10 @@ export class HelmChartStore extends ItemStore<HelmChart> {
protected sortVersions = (versions: IChartVersion[]) => {
return versions.sort((first, second) => {
return semver.compare(second.version, first.version);
const firstVersion = semver.coerce(first.version || 0);
const secondVersion = semver.coerce(second.version || 0);
return semver.compare(secondVersion, firstVersion);
});
};