Skip to content

feat(app): show unread session count on PWA taskbar badge - #53675

Closed
BoYanZh wants to merge 5 commits into
anomalyco:devfrom
BoYanZh:pwa-app-badge
Closed

BoYanZh wants to merge 5 commits into
anomalyco:devfrom
BoYanZh:pwa-app-badge

Conversation

@BoYanZh

@BoYanZh BoYanZh commented Oct 7, 2026 •

Copy link
Copy Markdown

Issue for this PR

Related to #43937 (that issue asks for a Desktop Electron taskbar badge; this PR adds the equivalent for the web PWA via the Badging API and does not close that issue).

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The installed web PWA (Chrome -> Install, Windows taskbar) currently shows no icon badge at all. In-app unread state only exists as a small dot on the session avatar, with no count.

This PR syncs the number of distinct sessions needing attention to the OS app icon using navigator.setAppBadge(n) / navigator.clearAppBadge(). That covers both unseen turn/error notifications and pending manual permission/question requests, matching the session avatar dot exactly. Viewing a session (or deleting it) clears its entry through the existing markViewed flow, which drops the count back down automatically. Browsers without the API are skipped silently.

Scope is intentionally narrow: selected server only (the same scope the avatar dots and mark-as-viewed use, so the badge can never get stuck on entries the UI cannot clear), no service worker push, so the badge only lives while the page runs. Deleting a session also clears its notification entries now, including a one-time startup reconciliation for already-stuck ones.

How did you verify your code works?

  • bun test in packages/app: 726 pass, 0 fail
  • bun run build in packages/app: passes
  • bun run typecheck in packages/app: same result as clean origin/dev (only the pre-existing src/custom-elements.d.ts failure, unrelated to this change)

Screenshots / recordings

No screenshot: the badge renders in OS taskbar chrome for an installed PWA, which I can't capture in this environment. Happy to add one from a Windows installed-PWA run if a maintainer wants it.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Oct 7, 2026
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Oct 7, 2026
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@thdxr

thdxr commented Oct 10, 2026

Copy link
Copy Markdown
Member

This branch has been upgraded to V2. We're no longer taking PRs for V1. If you think this is still relevant, please port it over and open it for V2.

— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

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