Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

fix(updates): show the title-bar Update button as soon as a new version is known

review2cef3f39d774
diff --git a/src/renderer/components/TabBar.tsx b/src/renderer/components/TabBar.tsx
index 0031961b2..a3f4ace86 100644
--- a/src/renderer/components/TabBar.tsx
+++ b/src/renderer/components/TabBar.tsx
@@ -312,9 +312,11 @@ export function TabBar({
title={
pendingUpdate.kind === 'downloaded'
? `nodeterm v${pendingUpdate.version} is ready, restart to update`
- : pendingUpdate.kind === 'manual'
- ? `nodeterm v${pendingUpdate.version} is available, download it to update`
- : 'This version is no longer supported, update to continue'
+ : pendingUpdate.kind === 'available'
+ ? `nodeterm v${pendingUpdate.version} is available, click to download it`
+ : pendingUpdate.kind === 'manual'
+ ? `nodeterm v${pendingUpdate.version} is available, download it to update`
+ : 'This version is no longer supported, update to continue'
}
onClick={() => runPendingUpdate(pendingUpdate)}
>
diff --git a/src/renderer/components/UpdateCard.flow.test.tsx b/src/renderer/components/UpdateCard.flow.test.tsx
index 6c1e30ca5..a1facd503 100644
--- a/src/renderer/components/UpdateCard.flow.test.tsx
+++ b/src/renderer/components/UpdateCard.flow.test.tsx
@@ -6,7 +6,7 @@ import { act } from 'react'
import { createRoot } from 'react-dom/client'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { UpdateCard, POLICY_REFRESH_MS, POLICY_RETRY_MS } from './UpdateCard'
-import { usePendingUpdate } from '../state/pendingUpdate'
+import { runPendingUpdate, usePendingUpdate } from '../state/pendingUpdate'
import { LAST_SEEN_VERSION_KEY } from '../lib/releaseNotes'
import type { UpdatePolicy } from '@shared/types'
@@ -92,12 +92,30 @@ const flush = async (): Promise<void> => {
describe('automatic downloads are quiet', () => {
beforeEach(mount)
- it('an automatic available renders nothing — no card, no pill', () => {
+ it('an automatic available renders no card and no minimized card pill', () => {
act(() => fire.available({ version: '0.6.0', notes: '', manual: false }))
act(() => fire.progress({ percent: 40 }))
expect(text()).toBe('')
})
+ it('a new version fills the title-bar button at once, before the download finishes', () => {
+ act(() => fire.available({ version: '0.6.0', notes: '', manual: false }))
+ expect(usePendingUpdate.getState().pending).toEqual({ kind: 'available', version: '0.6.0' })
+ act(() => fire.progress({ percent: 40 }))
+ expect(usePendingUpdate.getState().pending).toEqual({ kind: 'available', version: '0.6.0' })
+ act(() => fire.downloaded({ version: '0.6.0' }))
+ expect(usePendingUpdate.getState().pending).toEqual({ kind: 'downloaded', version: '0.6.0' })
+ })
+
+ it('clicking the button on an available update shows the download', () => {
+ act(() => fire.available({ version: '0.6.0', notes: '', manual: false }))
+ act(() => fire.progress({ percent: 40 }))
+ act(() => runPendingUpdate(usePendingUpdate.getState().pending!))
+ expect(check).toHaveBeenCalledTimes(1)
+ expect(restart).not.toHaveBeenCalled()
+ expect(text()).toContain('Downloading… 40%')
+ })
+
it('the finished download opens the ready card and fills the title-bar button', () => {
act(() => fire.available({ version: '0.6.0', notes: '', manual: false }))
act(() => fire.downloaded({ version: '0.6.0' }))
diff --git a/src/renderer/components/UpdateCard.tsx b/src/renderer/components/UpdateCard.tsx
index b4d8db49c..a0d9d98e7 100644
--- a/src/renderer/components/UpdateCard.tsx
+++ b/src/renderer/components/UpdateCard.tsx
@@ -14,9 +14,10 @@ import { noteVersionSeen, releaseHighlights, releaseNotesUrl } from '../lib/rele
// The updater lifecycle as one state machine (lib/updateCardState.ts — every transition rule and
// why lives there), driving a fixed bottom-right card. The contract, in short: automatic checks are
-// SILENT until an update is downloaded (the card's single prompt — the title-bar button keeps the
-// install path once the card is closed); a user-initiated check shows progress and its answer; a
-// staged update is never downgraded or re-opened by a repeat; a restart click shows
+// SILENT until an update is downloaded (the card's single prompt — the title-bar button already
+// shows from the moment the newer version is known, and keeps the install path once the card is
+// closed); a user-initiated check shows progress and its answer; a staged update is never
+// downgraded or re-opened by a repeat; a restart click shows
// Preparing…/Restarting… until the app goes away.
/** Re-read the mandatory-update policy this often (main's /v1/check cache refreshes on the same
@@ -171,6 +172,10 @@ export function UpdateCard(): JSX.Element | null {
useEffect(() => {
if (status.kind === 'downloaded' || status.kind === 'preparing' || status.kind === 'restarting') {
setPending({ kind: 'downloaded', version: status.version })
+ } else if (status.kind === 'available') {
+ // Even while the card stays quiet: the button is how an automatic check says "you are on an
+ // old version" without a progress bar nobody asked for.
+ setPending({ kind: 'available', version: status.version })
} else if (status.kind === 'manual') {
setPending({ kind: 'manual', version: status.version })
} else if (status.kind === 'required') {
diff --git a/src/renderer/state/pendingUpdate.ts b/src/renderer/state/pendingUpdate.ts
index 2e468c2cd..2ea92a45c 100644
--- a/src/renderer/state/pendingUpdate.ts
+++ b/src/renderer/state/pendingUpdate.ts
@@ -5,10 +5,16 @@ import { create } from 'zustand'
// subscriptions and writes here; the card's own ✕ only hides the CARD, never this, so a dismissed
// card still leaves a way to install. Transient: a relaunch re-derives it from the updater.
//
+// It appears the moment a newer version is KNOWN, not when its download finishes: the button is
+// what tells the user they are on an old version, and the background download can take minutes.
+//
+// available → newer version found, downloading in the background; click shows the download
+// (it is a user check, so it also restarts a background download that failed)
// downloaded → staged, click restarts into it
// manual → a .deb/.rpm Linux install can't self-install, click opens the download page
// required → below the channel minimum, click triggers a check (which downloads it)
export type PendingUpdate =
+ | { kind: 'available'; version: string }
| { kind: 'downloaded'; version: string }
| { kind: 'manual'; version: string }
| { kind: 'required'; minSupported: string | null }
diff --git a/src/renderer/styles.css b/src/renderer/styles.css
index 20ec049d2..6f9ff3e3b 100644
--- a/src/renderer/styles.css
+++ b/src/renderer/styles.css
@@ -417,7 +417,8 @@ body,
}
/* Title-bar "Update" button (Figma-style): right after the traffic lights, deliberately loud and
- not dismissible, shown only while an update is staged / owed (state/pendingUpdate.ts). */
+ not dismissible, shown from the moment a newer version is known until it is installed
+ (state/pendingUpdate.ts). */
.tabbar__update {
display: inline-flex;
align-items: center;