Skip to content

fix(updater): add action to update toast#2099

Open
janburzinski wants to merge 2 commits into
mainfrom
emdash/update-button-in-update-avaialble-toast-n27qh
Open

fix(updater): add action to update toast#2099
janburzinski wants to merge 2 commits into
mainfrom
emdash/update-button-in-update-avaialble-toast-n27qh

Conversation

@janburzinski
Copy link
Copy Markdown
Collaborator

little improvement with a direect cta

image

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 18, 2026

Greptile Summary

This PR improves the update-available toast by replacing the "Go to Settings to upgrade" copy with a direct "Update" action button that triggers download() immediately.

  • The description text is changed to "ready to install" but the action only starts a download — not an install — so the copy misleads users about what clicking the button will do.
  • No state guard is added before calling download(), so if the toast lingers and the button is clicked while a download is already underway, a duplicate RPC call is issued.

Confidence Score: 3/5

The 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

Important Files Changed

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()
Loading
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

Comment thread src/renderer/lib/stores/update-store.ts Outdated
Comment thread src/renderer/lib/stores/update-store.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant