fix(updater): add action to update toast#2099
Conversation
Greptile SummaryThis PR improves the update-available toast by replacing the "Go to Settings to upgrade" copy with a direct "Update" action button that triggers
Confidence Score: 3/5The change introduces a direct CTA in the update toast but ships with incorrect copy that misrepresents what the action does. The description 'ready to install' is shown to users at the available stage, before any download has occurred — clicking Update only downloads the package. This is a user-facing factual error on the notification's primary value proposition. src/renderer/lib/stores/update-store.ts — specifically the description string and the onClick handler in _maybeToastAvailable
|
| Filename | Overview |
|---|---|
| src/renderer/lib/stores/update-store.ts | Adds an "Update" action button to the available-update toast that calls download(). The description text "ready to install" is factually incorrect at this stage (the update still needs to be downloaded), and there is no state guard to prevent calling download() when a download is already in progress. |
Sequence Diagram
sequenceDiagram
participant Main as Main Process
participant Store as UpdateStore
participant Toast as Sonner Toast
participant User
Main->>Store: updateAvailableEvent(version)
Store->>Store: "setState({ status: 'available' })"
Store->>Store: _maybeToastAvailable(version)
Store->>Toast: show("Update Available", action: "Update")
User->>Toast: clicks "Update"
Toast->>Store: onClick → download()
Store->>Main: rpc.update.download()
Main-->>Store: updateDownloadingEvent
Store->>Store: "setState({ status: 'downloading' })"
Main-->>Store: updateDownloadedEvent
Store->>Store: "setState({ status: 'downloaded' })"
Note over User,Store: User must go to Settings to trigger install()
Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 2
src/renderer/lib/stores/update-store.ts:224
The description says "ready to install" but clicking "Update" calls `this.download()`, which only *downloads* the update — not installs it. The update goes through `available → downloading → downloaded` before it can be installed, so this copy is factually wrong and will confuse users who expect the action to install immediately.
```suggestion
description: `Version ${version} is ready to download.`,
```
### Issue 2 of 2
src/renderer/lib/stores/update-store.ts:227-229
`download()` has no guard against the current state. If the user clicks "Update" while a download is already in progress (e.g. they dismissed and re-triggered the toast, or the toast persists), `rpc.update.download()` gets called again. Adding a state check prevents duplicate RPC calls.
```suggestion
onClick: () => {
if (this.state.status === 'available') {
void this.download();
}
},
```
Reviews (1): Last reviewed commit: "fix(updater): add action to update toast" | Re-trigger Greptile
little improvement with a direect cta