Skip to content

feat: make check for updates menu item dynamic#1124

Open
nmggithub wants to merge 7 commits intopingdotgg:mainfrom
nmggithub:make-update-menu-item-dynamic
Open

feat: make check for updates menu item dynamic#1124
nmggithub wants to merge 7 commits intopingdotgg:mainfrom
nmggithub:make-update-menu-item-dynamic

Conversation

@nmggithub
Copy link
Copy Markdown
Contributor

@nmggithub nmggithub commented Mar 15, 2026

What Changed

EDIT: I was dumb and didn't realize I wasn't actually testing on a newer version of Electron. This PR makes changes and updates electron to the minimal version needed for this feature to work.

This PR cannot be merged in its current state as it depends on features not in upstream Electron yet, but I hope for that to change in the near future. Refs: electron/electron#50266

Once Electron truly supports it, this will allow us to change the label of the "Checking for Updates..." menu item on the fly.

Why

This provides a much better user experience by giving visual indications of what is happening during the update process.

UI Changes

(had some focus issues near the end, but I believe I covered most of the changes in the video)

Screen.Recording.2026-03-29.at.01.59.40.mov-compressed.mov

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included ~before/~after screenshots for any UI changes
  • I included a video for animation/interaction changes

Note

Make the 'Check for Updates' menu item dynamic based on update state

  • The 'Check for Updates' menu item in the App and Help menus now updates its label and enabled state in real time based on the current update status, using a shared DesktopUpdateStatusFriendlyLabelMap defined in packages/contracts/src/ipc.ts.
  • Clicking the menu item is now context-aware: it checks when idle, downloads when an update is available, and installs when downloaded; it no-ops in all other states.
  • Transient states ('up-to-date', 'check error') automatically reset to 'idle' after dialogs are dismissed or after a 5-second delay, keeping the menu actionable.
  • canCheckForUpdate in the web frontend is tightened to return true only when status is 'idle', and the settings panel button label now uses the same canonical map.
  • Behavioral Change: the menu item is disabled during checking, downloading, and error states, whereas it was previously always enabled.

Macroscope summarized dfa94af.


Note

Medium Risk
Touches the desktop auto-update state machine and menu wiring, plus bumps Electron, so regressions could affect update UX and state transitions. No auth/data-path changes, but behavior is timing- and state-dependent across desktop and web UI.

Overview
Makes the desktop “Check for Updates” menu item dynamic: it is now a persistent MenuItem whose label and enabled state update live based on DesktopUpdateState, and clicking it routes to check/download/install depending on current status.

Adds a shared DesktopUpdateStatusFriendlyLabelMap in @t3tools/contracts and reuses it in both the desktop menu and the web Settings “Version” update button; the web UI also tightens canCheckForUpdate to only allow checks from the idle state.

Introduces a transient-state cleanup path by adding reduceDesktopUpdateStateToIdle and scheduling an automatic reset back to idle after “up-to-date” or check-error states, with cleanup of the reset timer on app shutdown/signals. Also bumps electron to 40.7.0 to support dynamic menu updates.

Written by Cursor Bugbot for commit dfa94af. This will update automatically on new commits. Configure here.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 15, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 80b22215-4707-401a-b982-f782005556da

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Mar 15, 2026
@nmggithub nmggithub changed the title feat: make check for updates menu item dynamic (!waiting for upstream!) feat: make check for updates menu item dynamic Mar 17, 2026
@nmggithub nmggithub force-pushed the make-update-menu-item-dynamic branch from e847533 to 7b1d5e1 Compare March 17, 2026 21:20
@nmggithub nmggithub marked this pull request as ready for review March 17, 2026 21:47
@AriajSarkar
Copy link
Copy Markdown
Contributor

@nmggithub
I was reviewing the code and realized our PRs (#1123 and #1124) are perfect compliments for solving Issue #1204.

Merging my PR (#1123) first will establish the core update state machine in main.ts.
Once that's merged, u can rebase this PR (#1124) so your native menu logic reads directly from that shared state.
This guarantees both the React UI and the Native OS menu stay perfectly synced without needing duplicate event listeners.

Let me know what you think!

@nmggithub
Copy link
Copy Markdown
Contributor Author

@AriajSarkar definitely think there's a lot of overlap. Once your PR merges, I'll try to rebase my PR off yours!

@nmggithub nmggithub force-pushed the make-update-menu-item-dynamic branch from 7b1d5e1 to cd06a14 Compare March 29, 2026 04:54
updateCheckForUpdatesMenuItem(checkForUpdatesMenuItemInHelpMenu, state);
});

let applicationMenu: Menu | null = null;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused applicationMenu variable is dead code

Low Severity

The applicationMenu variable is declared and assigned in configureApplicationMenu but never read anywhere in the codebase. It's dead code that adds unnecessary state tracking.

Additional Locations (1)
Fix in Cursor Fix in Web

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will remove.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, no this isn't dead code (I don't think). I think it's meant to keep the reference alive so out dynamic updating of menu items works.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did some additional research, it might not be necessary, but I don't think it really needs to be fixed.

@github-actions github-actions bot added size:L 100-499 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels Mar 29, 2026
Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

void downloadAvailableUpdate();
break;
case "downloaded":
void installDownloadedUpdate();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Menu click installs update without user confirmation

High Severity

When the native menu item shows "Update Downloaded" and the user clicks it, handleCheckForUpdatesMenuClick calls installDownloadedUpdate() directly, which destroys all windows and calls autoUpdater.quitAndInstall() without any confirmation dialog. The web UI's equivalent click handler uses window.confirm() before calling bridge.installUpdate(), but the native menu path has no such safeguard. A user clicking the menu item to learn more about the downloaded update would have their app quit and restart immediately with no chance to save work.

Additional Locations (1)
Fix in Cursor Fix in Web

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works just like the web UI, so I think its fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants