Skip to content

fix: allow skipped updates to appear on manual check for updates#3273

Merged
jeanfbrito merged 1 commit intodevfrom
fix/skip-update-manual-check
Mar 23, 2026
Merged

fix: allow skipped updates to appear on manual check for updates#3273
jeanfbrito merged 1 commit intodevfrom
fix/skip-update-manual-check

Conversation

@jeanfbrito
Copy link
Copy Markdown
Member

@jeanfbrito jeanfbrito commented Mar 20, 2026

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

  • Add isUserInitiatedCheck flag to distinguish manual vs automatic update checks
  • Only honor skippedUpdateVersion during automatic (startup) checks
  • User-initiated checks bypass the skip filter, matching OS-level update behavior (macOS/Windows)

Test plan

  • Skip a version via the update notification dialog
  • Restart the app — verify the skipped version does not appear on automatic startup check
  • Open About → Check for Updates — verify the skipped version does appear
  • Verify non-skipped versions continue to appear on both automatic and manual checks

Summary by CodeRabbit

  • Bug Fixes
    • Refined update notification behavior for previously skipped versions when performing manual update checks.

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.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 20, 2026

Walkthrough

Added a module-level flag isUserInitiatedCheck to differentiate update check origins. During automatic startup checks, the flag is reset to false. For user-triggered checks from the About dialog, the flag is set to true before the check. Skipped version notifications are now suppressed only when the flag is false (automatic checks), allowing users to see previously skipped versions during manual checks.

Changes

Cohort / File(s) Summary
User-Initiated Update Check Handling
src/updates/main.ts
Added module-level flag to distinguish user-initiated from automatic update checks; skipped version notifications now only suppressed during automatic checks, not user-initiated ones.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested labels

type: bug

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and accurately summarizes the main change: allowing skipped updates to appear when users manually check for updates.
Linked Issues check ✅ Passed The code changes fully implement the CORE-1389 objective by introducing isUserInitiatedCheck flag to distinguish manual vs automatic checks, ensuring skipped versions only suppress automatic checks.
Out of Scope Changes check ✅ Passed All changes are directly related to the CORE-1389 objective and within scope of the update check flow modification.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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.

❤️ Share

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

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/updates/main.ts (1)

349-366: Flag is never reset after user-initiated check completes.

Once isUserInitiatedCheck is set to true, it remains true until 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 the update-available, update-not-available, and error event handlers.

Additionally, the try/catch block won't catch errors thrown inside the setTimeout callback. This is mitigated by the autoUpdater.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

📥 Commits

Reviewing files that changed from the base of the PR and between 0790d9f and dcf9403.

📒 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/fuselage for all UI work and only create custom components when Fuselage doesn't provide what's needed
Check Theme.d.ts for 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 false before the startup check ensures automatic checks always respect the skip preference.

@jeanfbrito jeanfbrito merged commit 8107bcd into dev Mar 23, 2026
7 checks passed
@jeanfbrito jeanfbrito deleted the fix/skip-update-manual-check branch March 23, 2026 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant