Skip to content

an open-source alternative to the dots, bots and muses of the world, run an office of claude code/codex like agents on your laptop, sandboxes or anywhere, uses your existing subscriptions

feat(updater): acknowledge a successful check on the badge

Chaitanya Giri1ca01b09a698
diff --git a/src/renderer/src/components/UpdateBadge.tsx b/src/renderer/src/components/UpdateBadge.tsx
index cf9d3aa4..f68cf60c 100644
--- a/src/renderer/src/components/UpdateBadge.tsx
+++ b/src/renderer/src/components/UpdateBadge.tsx
@@ -25,6 +25,11 @@ export function UpdateBadge() {
/** The version whose download was just started, for the "now replace the
* app" notice. Local state: it is a one-off explanation, not an update state. */
const [started, setStarted] = useState<string | null>(null);
+ /** Brief, positive "checked, you are current" flash after a MANUAL check that
+ * found no update. Without it a successful check settles silently back to the
+ * grey "latest" chip, which is indistinguishable from a click that did
+ * nothing, and that is exactly why the badge read as broken. */
+ const [checkedOk, setCheckedOk] = useState(false);
useEffect(() => {
// Subscribe first, then pull — main may have emitted before this window
@@ -36,13 +41,32 @@ export function UpdateBadge() {
return off;
}, []);
+ // The acknowledgement is a flash, not a mode: clear it after a few seconds so
+ // the badge returns to its quiet resting state.
+ useEffect(() => {
+ if (!checkedOk) return;
+ const t = setTimeout(() => setCheckedOk(false), 3500);
+ return () => clearTimeout(t);
+ }, [checkedOk]);
+
const view = describeUpdate(status, __APP_VERSION__);
const onClick = useCallback(async () => {
if (view.action === 'none' || busy) return;
setBusy(true);
try {
- if (view.action === 'check') await window.cth.updateCheckNow();
+ if (view.action === 'check') {
+ const res = await window.cth.updateCheckNow();
+ // A successful "already current" check has to say so out loud. runCheck
+ // has settled lastStatus by the time this resolves, so read it back: a
+ // no-update result flashes the acknowledgement; an available update is
+ // already loud on its own (the chip changes) so it is left alone.
+ if (res?.ok) {
+ const cur = await window.cth.updateCurrent?.();
+ const st = cur?.state;
+ if (!st || st === 'not-available' || st === 'idle' || st === 'just-updated') setCheckedOk(true);
+ }
+ }
else if (view.action === 'manual' && status) {
// The click IS the download. Auto-update lives in Settings.
const url = manualDownloadUrl(status, window.cth.platform, window.cth.arch);
@@ -164,6 +188,35 @@ export function UpdateBadge() {
</div>
</div>
)}
+ {/* A successful "you are already current" check must be visible, or it is
+ indistinguishable from a dead click. Shows only for the manual-check
+ no-update result, and auto-dismisses. */}
+ {checkedOk && !started && (
+ <div
+ role="status"
+ aria-live="polite"
+ className="cth-titlebar-nodrag"
+ style={{
+ position: 'absolute', top: 'calc(100% + 6px)', left: 0, zIndex: 400,
+ width: 300, padding: '10px 12px',
+ background: 'var(--cth-paper-100)', color: INK,
+ border: `2px solid ${INK}`, boxShadow: `4px 4px 0 ${INK}`,
+ fontFamily: 'var(--cth-font-ui)', fontSize: 12.5, lineHeight: 1.5, textAlign: 'left'
+ }}
+ >
+ <div style={{ display: 'flex', alignItems: 'center', gap: 8, fontFamily: 'var(--cth-font-mono, monospace)', fontWeight: 700, fontSize: 13 }}>
+ <span aria-hidden style={{
+ display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
+ width: 18, height: 18, borderRadius: 999,
+ background: 'var(--cth-mint-light, #d0f0e0)', color: 'var(--cth-ink-900)', fontSize: 12
+ }}>&#10003;</span>
+ You are on the latest version.
+ </div>
+ <div style={{ marginTop: 4, color: 'var(--cth-ink-700)' }}>
+ v{__APP_VERSION__} is the newest release. Checked just now.
+ </div>
+ </div>
+ )}
</span>
);
}
diff --git a/test/update-badge-acknowledgement.test.cjs b/test/update-badge-acknowledgement.test.cjs
new file mode 100644
index 00000000..5c52d405
--- /dev/null
+++ b/test/update-badge-acknowledgement.test.cjs
@@ -0,0 +1,35 @@
+/**
+ * A successful update check must be visible.
+ *
+ * The complaint that started this: on the latest release, a manual check
+ * succeeds, finds nothing, and the badge settles back to a quiet grey "latest"
+ * chip. A check that worked perfectly and a click that never registered look
+ * identical, so the button reads as broken. The fix is a brief, positive
+ * acknowledgement after a manual no-update check. Source-string checks, because
+ * UpdateBadge is a React component with no jsdom harness in this repo; deleting
+ * the acknowledgement wiring must not pass silently.
+ */
+const test = require('node:test');
+const assert = require('node:assert/strict');
+const { readFileSync } = require('node:fs');
+const { join } = require('node:path');
+const read = (rel) => readFileSync(join(__dirname, '..', rel), 'utf8');
+const SRC = read('src/renderer/src/components/UpdateBadge.tsx');
+
+test('the check branch acknowledges a no-update result', () => {
+ assert.ok(/setCheckedOk\(true\)/.test(SRC),
+ 'the manual check must set the acknowledgement, or a successful check stays silent');
+ assert.ok(/updateCheckNow\(\)/.test(SRC) && /updateCurrent\?\.\(\)/.test(SRC),
+ 'it reads the settled status back after the check to tell a no-update result from an available one');
+ assert.ok(/'not-available'/.test(SRC),
+ 'the acknowledgement is gated on a no-update state, not fired blindly for every check');
+});
+
+test('the acknowledgement renders and auto-dismisses', () => {
+ assert.ok(/checkedOk && !started &&/.test(SRC),
+ 'the acknowledgement popover must render when checkedOk is set');
+ assert.ok(/on the latest version/i.test(SRC),
+ 'it must say, in words, that the user is already current');
+ assert.ok(/setTimeout\(\(\) => setCheckedOk\(false\)/.test(SRC),
+ 'it must auto-dismiss, or it is a stuck mode instead of a flash');
+});