Skip to content

fix(updater): persist update banner dismissal across restarts - #1332

Closed
yexisu wants to merge 1 commit into
vastsa:mainfrom
yexisu:fix/update-dismiss-persist
Closed

yexisu wants to merge 1 commit into
vastsa:mainfrom
yexisu:fix/update-dismiss-persist

Conversation

@yexisu

@yexisu yexisu commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Problem

In manual update mode, the update banner's dismiss (×) button only wrote component-local React state (useState in UpdateBanner.tsx). Every app restart re-showed the same notice for a version the user had already declined (issue #1317, problem 1 — update dismissal not persisted). Problem 2 of that issue (asktool cards reappearing) is already fixed by #1309.

Fix

Record the dismissal durably instead of in component memory:

  • New updatesDismiss IPC channel; UpdateBanner calls it when the user dismisses.
  • AppUpdaterController.dismiss() stores the version and persists it via the existing host settings channel as updateDismissedVersion (mirrors the existing lastNotifiedUpdateVersion persistence wiring).
  • UpdateState gains a dismissed flag; the banner hides from the pushed flag, so the decision survives restarts.
  • When a newer version is discovered, the stale dismissal is cleared (in memory and in settings), so future releases keep notifying.
  • host-core validate_settings_value validates the new key (non-empty string up to 128 chars, or null to clear), with regression tests.

Validation

  • update-preference.test.mjs 6/6 pass (incl. new regression test asserting the banner consumes update.dismissed and calls api.updatesDismiss())
  • auto-update.test.mjs 8/8 pass
  • desktop tsc --noEmit clean; cargo fmt --check clean
  • host-core unit tests require a local Rust linker; left to CI

Fixes #1317

…#1317)

The update banner's dismiss button only wrote component-local state, so
every restart brought the same notice back for a version the user had
already declined. Record the dismissed version through a new
`updatesDismiss` IPC channel into host settings
(`updateDismissedVersion`), surface it as a `dismissed` flag on
UpdateState, and clear it when a newer version is discovered so future
releases keep notifying.

Validated: update-preference tests 6/6, auto-update tests 8/8, desktop
typecheck clean, cargo fmt --check clean. host-core test run requires a
Rust toolchain and is left to CI.

Fixes vastsa#1317
@vastsa

vastsa commented Oct 3, 2026

Copy link
Copy Markdown
Owner

Thanks for the focused persistence change. The manual-mode reappearance is real, and saving the dismissed version addresses that path. I can’t merge this as a complete fix for #1317 yet: the issue also explicitly reports that dismissing in in-app mode should stop the background download. Here, dismiss() only sets the dismissed flag and persists the version; it leaves the updater in in-app mode with autoDownload enabled, so the download continues after the banner hides. Please cover that behavior with a controller-level regression test, or narrow the PR/issue claim so it does not mark the unresolved behavior fixed. This head also predates current main and needs refreshing before a landing review. Thanks for the work.

@vastsa

vastsa commented Oct 3, 2026

Copy link
Copy Markdown
Owner

Thanks for the original persistence fix. I completed the in-app path so dismissal also cancels the active download and prevents that release from restarting automatically. The maintainer follow-up #1339 has merged, with your original commit retained in its history. I’m closing this PR to avoid landing the same fix twice. Thanks for the contribution.

@vastsa

vastsa commented Oct 3, 2026

Copy link
Copy Markdown
Owner

The completed maintainer follow-up #1339 is merged.

@vastsa vastsa closed this Oct 3, 2026
@yexisu

yexisu commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

确认关闭合理:刚把分支对最新 main rebase 时发现上游已在 e356fb348 中落地了等价(且更完整——activeDownloadCancellation 真实取消进行中的传输)的 in-app dismiss 停止下载实现,连同 1f51acd69 的持久化路径,#1317 的两条行为都已覆盖。我的 0e0b5745e(downloadSuppressedFor 抑制方案)是冗余实现,不再推送。感谢接手与落地。

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.

[Bug] v0.16.0 更新"忽略"不持久化 + asktool 对话框复弹提交报错(UI 状态与后端不同步两例)

2 participants