Skip to content

fix(dashboard): gate PWA update prompt by permission and stop re-prompting - #2079

Closed
zsuroy wants to merge 3 commits into
TencentCloud:mainfrom
zsuroy:fix/pwa-update-prompt-permission
Closed

zsuroy wants to merge 3 commits into
TencentCloud:mainfrom
zsuroy:fix/pwa-update-prompt-permission

Conversation

@zsuroy

@zsuroy zsuroy commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Related: #329 (open — PWA「新版本已就绪 / 立即更新」横幅在更新/重启后复现), follow-up to #441 (按权限门控更新 UI,但未覆盖 PWA 横幅); background #156 / #393.

修复 PWA 更新横幅的两个问题:

  1. 非管理员不应被提示更新。PwaUpdatePrompt(PWA「新版本已就绪 / 立即更新」横幅)对所有用户挂载、无权限门控;非管理员点击「立即更新」还会调用需要 update 权限的后端服务重启(被 403 拒绝)。现在仅对拥有「应用更新」(update) 权限的用户渲染,与 fix: gate update UI by permission and speed up local tests #441 已采用的方案一致(userCan(user, "update"),同头部/侧栏版本角标 AppVersionBadge)。因此在「设置 → 用户/角色」中关闭该权限的用户也不再看到提示。
  2. 关闭后仍反复弹出。「稍后」原先只改组件本地 state,而 Waiting Service Worker 在页面刷新后依然存在,于是每次加载/重新挂载又弹。现在把关闭状态写入 sessionStorage,同一标签页会话内不再重复弹出(与 fix(dashboard): wait for service worker activation before reload #389 的激活竞态修复互补;[bug] 更新完版本启动时,提示新版已就绪,立即更新 #329 的“更新/重启后仍提示”根因本次未直接改动)。

附带:无更新权限的用户不再触发 service_mode 探测请求。

Target branch

  • Base is develop (feature / fix — default)
  • Base is main (release/* or hotfix/* only)

Type of change

  • Bug fix

Test plan

  • make all — 4750 passed, 32 skipped

  • cd dashboard && npx tsc -b — 通过

  • cd dashboard && npm run build(tsc + vite + PWA)— 通过

  • pre-commit(make precommit + dashboard build)通过

  • 手工验证:管理员可见横幅;无 update 权限的用户不可见;点「稍后」后刷新同一标签页不再弹出。

  • make all passes locally

  • Added/updated tests

Checklist

  • Updated CHANGELOG.md (if user-facing)
  • README / docs updated (if needed)

github-actions Bot and others added 3 commits October 14, 2026 23:50
…elop-after-1.0.2b8

chore: sync main into develop after 1.0.2b8
…ud#2066)

* fix(chat): show peer expert composer defaults and theme the beta badge

Cloud collab shadow experts dropped the peer's model, connectors, knowledge
bases, and conversation mode, so the local composer could not show them.
The sidebar Beta chip also stayed a fixed red instead of the theme color.

* fix: name experts in usage stats and title cron sessions

Admin usage grouped other users' experts by id because the page only knew
the signed-in account's agents. Scheduled runs also left the thread untitled
until the next user message when the push failed or never ran.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: jubaoliang <jubaoliang@tencent.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…pting

The PWA "new version is ready" banner (PwaUpdatePrompt) was mounted for every user regardless of permissions, and only tracked dismissal in local component state, so it reappeared on every reload while the update stayed pending.

- Only render the banner for users holding the "update" permission (matches AppVersionBadge); non-admins are no longer prompted.
- Remember dismissal in sessionStorage so the same pending update does not pop again within the session.
- Skip the service_mode probe for users that cannot update.

Follow-up to TencentCloud#441 (permission-gated update UI, which did not cover the PWA banner); background TencentCloud#156/TencentCloud#393. Refs TencentCloud#329.
@zsuroy

zsuroy commented Oct 15, 2026

Copy link
Copy Markdown
Contributor Author

提交错了分支

@zsuroy zsuroy closed this Oct 15, 2026
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.

2 participants