Skip to content

[BUG]: Notification badge (red dot) on sidebar icon does not clear after viewing session or page refresh #16581

@cyberprophet

Description

@cyberprophet

Description

The notification badge (red/blue dot) displayed on the top-right of sidebar project icons does not disappear after the user views the session or refreshes the page.

Steps to Reproduce

  1. Open opencode web UI
  2. Have an active session that receives a response (AI turn completes)
  3. A red/blue dot appears on the sidebar project icon
  4. Click into the session to view it
  5. Expected: Badge disappears
  6. Actual: Badge remains visible
  7. Refresh the page
  8. Expected: Badge disappears (state was viewed)
  9. Actual: Badge still remains visible

Root Cause (Technical)

markViewed() is only called inside syncSessionRoute() when the session changes (line 1658 in layout.tsx):

if (session !== activeRoute.session) {
  activeRoute.session = session
  activeRoute.sessionProject = syncSessionRoute(directory, id, root) // markViewed called here
  return
}

This means:

  • If the user is already on the session when a notification arrives → markViewed() is never called
  • After page refresh, the same session URL is restored → session !== activeRoute.session is false on first render → markViewed() is never called
  • Notification state is persisted to localStorage with viewed: false, so it survives refresh

Environment

  • Platform: Web UI
  • Component: packages/app/src/pages/layout.tsx, packages/app/src/context/notification.tsx

Suggested Fix

  1. Call markViewed() on initial page load if the current URL matches a session
  2. Or add a reactive effect that calls markViewed() whenever the current session has unseen notifications

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions