Skip to content

Commit 7b43a21

Browse files
beautyfreeclaude
andcommitted
fix(updater): adopt returned snapshot so "Restart & install" shows at once
After a successful download the button briefly reverted to "Download update" because setUpdateBusy('idle') ran before the push event 'app_update_status_changed' carrying state='ready' reached the renderer. Now we update updateStatus from the RPC snapshot returned synchronously, so the state transition is atomic with the busy reset. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent ca36927 commit 7b43a21

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/mainview/pages/Settings.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,12 @@ export default function SettingsPage() {
129129
async function handleUpdateDownload() {
130130
setUpdateBusy('downloading')
131131
try {
132-
// Returns a status snapshot; if the final state is 'error', the
133-
// autoUpdater rejected (network, signature, etc.) and we should surface
134-
// that to the user instead of just re-enabling the button.
135132
const snapshot = await invoke('app_update_download')
133+
// Adopt the returned snapshot immediately so the button flips to
134+
// "Restart & install" without waiting for the push event to race
135+
// through — previously the busy reset happened before the event
136+
// arrived and the UI briefly showed "Download update" again.
137+
if (snapshot) setUpdateStatus(snapshot)
136138
if (snapshot?.state === 'error' && snapshot.error) {
137139
toast(snapshot.error, 'destructive')
138140
}

0 commit comments

Comments
 (0)