You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 6ecba3b
Browse filesBrowse the repository at this point in the historyBrowse files
fix(update): separate downloading from restarting, and put the refusal in the action (#573)
Closes#344, #569, #570.
Three problems on one path, all of them about the app deciding something on
the user's behalf at a moment nobody chose.
## The restart was not asked for
installUpdate ended with an unconditional relaunch(), so a download finishing
closed the app. Downloading and restarting are now separate: installUpdate
stages the update and stops, and the status bar offers "Restart to finish
update" for the user to take when they are ready. That is what VS Code and
Slack do, and for the same reason — the download is harmless, the restart is
the part that can lose work.
There was no UI for the "downloaded" state at all, so a relaunch that failed
or hung left the status bar showing nothing.
## The refusal lived in the button
The checks for a running query and unsaved tabs were in the status bar's
onClick. installUpdate itself had none. One caller today, but nothing said
the next one had to bring its own — the same shape as the grid's save path
before #529.
Worse, they ran once, at the click, before a download that can take minutes,
and the restart then happened against a state nobody had looked at since. A
query started or a tab edited during the download was destroyed by a restart
authorised before either existed.
updateBlockers lives in src/lib/update-guard.ts, so both moments can ask
without the settings store having to know about queries or editor tabs. It is
checked before the download and again before the restart. It reports every
reason rather than the first, so fixing one does not walk into the next.
## A failed install left the status bar lying
installUpdate set "downloading" and then returned without touching it if
pendingUpdate had been cleared — which any concurrent check does, including
the one the status bar fires on mount. The spinner stayed forever, and the
button that could retry only renders in the "available" state.
It now reports what happened and leaves a state the user can act from. The
same applies when relaunch fails: the update is on disk, so it says so and
says to quit and reopen, rather than implying a re-download.
## Tests
Five on the guard, four new on the store. Three fail against the previous
version.
Two existing tests changed rather than being deleted: the relaunch assertion
moved to restartToApply, and the two status-bar tests that asserted the
button refuses now assert the refusal itself, since that is where it moved.
Co-authored-by: Claude Opus 5 <[email protected]>
0 commit comments