Skip to content

The agent that grows with you

fix(desktop): treat unknown version as absent in status labels

funky-xamarinb911605dc519
diff --git a/apps/desktop/src/lib/version-status.test.ts b/apps/desktop/src/lib/version-status.test.ts
index ef91c561367..4da0ce73e67 100644
--- a/apps/desktop/src/lib/version-status.test.ts
+++ b/apps/desktop/src/lib/version-status.test.ts
@@ -49,6 +49,14 @@ describe('resolveVersionStatus', () => {
expect(client().unknown).toBe(true)
})
+ it('treats the unknown sentinel as missing, without borrowing the client sha for a backend', () => {
+ expect(client({ version: 'unknown', sha: 'abc1234' }).label).toBe('abc1234')
+ expect(client({ version: 'unknown', sha: 'abc1234' }).unknown).toBe(false)
+ expect(client({ version: 'unknown' }).unknown).toBe(true)
+ expect(backend({ version: 'unknown', sha: 'abc1234' }).unknown).toBe(true)
+ expect(client({ version: 'git.abc1234' }).label).toBe('vgit.abc1234')
+ })
+
it('drops the diff while an apply is in flight', () => {
const applying = client({ applying: true, behind: 3, sha: 'abc1234', version: '0.4.2' })
diff --git a/apps/desktop/src/lib/version-status.ts b/apps/desktop/src/lib/version-status.ts
index 2fc615ae52f..d7028616629 100644
--- a/apps/desktop/src/lib/version-status.ts
+++ b/apps/desktop/src/lib/version-status.ts
@@ -83,7 +83,7 @@ export function resolveVersionStatus({
}: VersionStatusInput): VersionStatusResult {
// The label names the distance past the release; the commit stays in the
// tooltip and the expanded version details.
- const version: null | string = rawVersion && shortVersion(rawVersion)
+ const version: null | string = rawVersion && rawVersion !== 'unknown' ? shortVersion(rawVersion) : null
const client = target === 'client'
const busy = applying || restarting
// updateAvailable covers every "behind but uncountable" shape: shallow