fix: allow skipped updates to appear on manual check for updates#3273
fix: allow skipped updates to appear on manual check for updates#3273jeanfbrito merged 1 commit intodevfrom
Conversation
The update-available handler unconditionally honored skippedUpdateVersion, silently suppressing skipped versions even when the user manually triggered Check for Updates from the About dialog. This left no recovery path for users who skipped a version and later changed their mind. Add an isUserInitiatedCheck flag so the skip preference only applies to automatic startup checks, not user-initiated ones.
WalkthroughAdded a module-level flag Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/updates/main.ts (1)
349-366: Flag is never reset after user-initiated check completes.Once
isUserInitiatedCheckis set totrue, it remainstrueuntil the next startup check explicitly resets it. If the application evolves to support additional automatic checks (e.g., periodic checks), they would incorrectly behave as user-initiated. Consider resetting the flag in theupdate-available,update-not-available, anderrorevent handlers.Additionally, the
try/catchblock won't catch errors thrown inside thesetTimeoutcallback. This is mitigated by theautoUpdater.addListener('error', ...)handler (line 321), but the pattern is slightly misleading.🛠️ Suggested approach: reset flag in event handlers
autoUpdater.addListener('update-available', ({ version }) => { const skippedUpdateVersion = select( ({ skippedUpdateVersion }) => skippedUpdateVersion ); if (!isUserInitiatedCheck && skippedUpdateVersion === version) { dispatch({ type: UPDATES_NEW_VERSION_NOT_AVAILABLE }); + isUserInitiatedCheck = false; return; } // Prevent showing "updates" that are actually downgrades // ... dispatch({ type: UPDATES_NEW_VERSION_AVAILABLE, payload: version as string, }); + isUserInitiatedCheck = false; }); autoUpdater.addListener('update-not-available', () => { dispatch({ type: UPDATES_NEW_VERSION_NOT_AVAILABLE }); + isUserInitiatedCheck = false; });Also consider adding reset in the error handler if appropriate.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/updates/main.ts` around lines 349 - 366, isUserInitiatedCheck is set to true in listen(UPDATES_CHECK_FOR_UPDATES_REQUESTED...) but never reset, and the current try/catch won't catch errors thrown inside the setTimeout callback; update the code to reset isUserInitiatedCheck = false in the autoUpdater event handlers 'update-available', 'update-not-available', and 'error' so the flag only covers the user-initiated window, and ensure errors from the delayed call are handled by either moving the try/catch inside the setTimeout callback that calls autoUpdater.checkForUpdates() or explicitly relying on the existing autoUpdater.addListener('error', ...) handler to dispatch the same UPDATES_ERROR_THROWN payload (use the same dispatch structure) so exceptions from autoUpdater.checkForUpdates() are surfaced correctly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/updates/main.ts`:
- Around line 349-366: isUserInitiatedCheck is set to true in
listen(UPDATES_CHECK_FOR_UPDATES_REQUESTED...) but never reset, and the current
try/catch won't catch errors thrown inside the setTimeout callback; update the
code to reset isUserInitiatedCheck = false in the autoUpdater event handlers
'update-available', 'update-not-available', and 'error' so the flag only covers
the user-initiated window, and ensure errors from the delayed call are handled
by either moving the try/catch inside the setTimeout callback that calls
autoUpdater.checkForUpdates() or explicitly relying on the existing
autoUpdater.addListener('error', ...) handler to dispatch the same
UPDATES_ERROR_THROWN payload (use the same dispatch structure) so exceptions
from autoUpdater.checkForUpdates() are surfaced correctly.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 8c7941eb-ecf4-454c-9f82-58da3c95ff5f
📒 Files selected for processing (1)
src/updates/main.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: check (ubuntu-latest)
- GitHub Check: check (macos-latest)
- GitHub Check: check (windows-latest)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx}: Use TypeScript strict mode enabled in TypeScript configuration
Use React functional components with hooks instead of class components
Follow FSA (Flux Standard Action) pattern for Redux actions
Use camelCase for file names and PascalCase for component file names
All code must pass ESLint and TypeScript checks
Write self-documenting code with clear naming; avoid unnecessary comments except for complex business logic or non-obvious decisions
Use Fuselage components from@rocket.chat/fuselagefor all UI work and only create custom components when Fuselage doesn't provide what's needed
CheckTheme.d.tsfor valid color tokens when using Fuselage components
Use defensive coding with optional chaining and fallbacks for Linux-only APIs (process.getuid(), process.getgid(), process.geteuid(), process.getegid()) to ensure cross-platform compatibility across Windows, macOS, and Linux
Files:
src/updates/main.ts
🧠 Learnings (1)
📓 Common learnings
Learnt from: Ram-sah19
Repo: RocketChat/Rocket.Chat.Electron PR: 3254
File: .github/workflows/build-release.yml:80-94
Timestamp: 2026-03-11T06:38:40.426Z
Learning: In the RocketChat/Rocket.Chat.Electron repository, the issues flagged in `.github/workflows/build-release.yml` (e.g., `node12` runtime in the release action and missing `snapcraft_token` input), i18n files, and `electron-builder.json` are pre-existing in the `develop` branch and are pulled in during merge conflict resolution. Do not flag these as new issues introduced by PRs that only modify `src/injected.ts` and `src/ui/main/rootWindow.ts`.
🔇 Additional comments (3)
src/updates/main.ts (3)
165-166: LGTM!Module-level flag to track user-initiated checks is a reasonable approach for this single-process Electron main context.
249-252: LGTM!The condition correctly implements the intended behavior: skipped versions are filtered only during automatic checks, allowing user-initiated checks to show all available versions including previously skipped ones.
332-347: LGTM!Explicitly resetting the flag to
falsebefore the startup check ensures automatic checks always respect the skip preference.
Summary
Fixes the update skip behavior so that manually checking for updates (About → Check for Updates) shows all available versions, including previously skipped ones. The skip preference now only suppresses automatic startup checks.
Jira: https://rocketchat.atlassian.net/browse/CORE-1389
Changes
isUserInitiatedCheckflag to distinguish manual vs automatic update checksskippedUpdateVersionduring automatic (startup) checksTest plan
Summary by CodeRabbit