Skip to content

fix(notifications): refresh sidebar badge when marking as read#478

Merged
netchampfaris merged 1 commit into
developfrom
fix/notification-count-stale
Apr 28, 2026
Merged

fix(notifications): refresh sidebar badge when marking as read#478
netchampfaris merged 1 commit into
developfrom
fix/notification-count-stale

Conversation

@netchampfaris
Copy link
Copy Markdown
Contributor

Summary

  • The sidebar inbox badge stayed stuck on the unread count after a user opened/cleared a notification — only a full page reload made it disappear.
  • Root cause: Notifications.vue reloaded via this.\$getResource('Unread Notifications Count'), which only looks up the legacy createResource cache. The actual sidebar badge reads from the useCall-based unreadNotifications resource in frontend/src/data/notifications.ts, which lives in a separate registry and was never being refreshed.
  • Fix: import unreadNotifications directly and call .reload() on it from markAsRead, markAllAsRead, and mounted().

Fixes #365

Test plan

  • With one unread notification, sidebar badge shows 1.
  • Open the Inbox page and click "View Discussion" on the notification — sidebar badge updates to 0 without a page reload.
  • Click "Mark all as read" with multiple unread — badge clears immediately.
  • When a new notification arrives via realtime, the badge increments (existing behavior, unchanged).

🤖 Generated with Claude Code

…s read

The sidebar badge reads from the useCall-based unreadNotifications resource
in data/notifications.ts, but Notifications.vue was reloading via
$getResource('Unread Notifications Count'), which targets the legacy
createResource cache. The two registries are separate, so the new
useCall resource never refreshed and the badge stayed stale until reload.

Fixes #365
@cypress
Copy link
Copy Markdown

cypress Bot commented Apr 28, 2026

gameplan    Run #428

Run Properties:  status check passed Passed #428  •  git commit b8a5a692e0 ℹ️: Merge 0c5d1735d2810cdc14285c39d09bad6c6a1fc342 into 292355acd42942e5fe78a69f804f...
Project gameplan
Branch Review fix/notification-count-stale
Run status status check passed Passed #428
Run duration 00m 59s
Commit git commit b8a5a692e0 ℹ️: Merge 0c5d1735d2810cdc14285c39d09bad6c6a1fc342 into 292355acd42942e5fe78a69f804f...
Committer Faris Ansari
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 7
⚠️ You've recorded test results over your free plan limit.
Upgrade your plan to view test results.
View all changes introduced in this branch ↗︎

@netchampfaris netchampfaris merged commit 27c28ca into develop Apr 28, 2026
3 checks passed
@netchampfaris netchampfaris deleted the fix/notification-count-stale branch April 28, 2026 13:30
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.

Notification count doesn't reduce when I click on notification

1 participant