[Frontend] Fix unread-notification badge inflating by the full event buffer
Overview & Background
The unread-notification badge is incremented by the entire buffered event list (up to 100 items) on every effect run, not by the count of new items. In frontend/src/components/NotificationDropdown.tsx:88-113, the effect depends on [streamEvents, isOpen, formatEventMessage]; newNotifications = streamEvents.map(...) maps all buffered events, then if (!isOpen) { setUnreadCount((prev) => prev + newNotifications.length); }. Consequences: one new event while closed bumps the badge by N+1; closing the dropdown (which just marked everything read) immediately re-adds the full buffer as unread because isOpen flipped and the effect re-fired. The setNotifications dedupe masks the list but not the counter. Related: notification IDs sse-${event.type}-${event.timestamp} collide for same-type events in the same millisecond, silently dropping one.
Technical Specification & Architecture
- Track only genuinely new events (e.g. a processed-IDs ref, or count only events newer than last-seen).
- Do not re-derive notifications when only
isOpenchanges — split the effect. - Make notification IDs collision-proof.
Target Files
frontend/src/components/NotificationDropdown.tsx
Acceptance Criteria
- [ ] Badge increments by exactly one per new event.
- [ ] Closing the dropdown does not resurrect cleared unread counts.
- [ ] Same-type events in the same millisecond are all kept.
- [ ] Unit tests cover open/close transitions and multi-event bursts.
@Lebmont8 has applied to work on this issue as part of the Stellar Wave Program's 11th wave.
Hello, I'm interested in taking this issue on.
I'm a full-stack developer with 4+ years of experience, working with TypeScript, React and Next.js. I'll build this to match the patterns already used elsewhere in the project, with tests covering the new behavior.
Planned approach, based on the acceptance criteria:
- Process only genuinely new stream events instead of adding the entire event buffer to the unread count.
- Keep opening and closing the dropdown from reprocessing previously read events.
- Preserve distinct events even when their type and timestamp are identical.
- Extend the notification tests to cover incremental arrivals, open/close transitions and same-millisecond event bursts.
Looking forward to contributing — please assign this issue to me.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @Lebmont8 to this issue.
@Fury03 has applied to work on this issue as part of the Stellar Wave Program's 11th wave.
I can work on this
ℹ️ Repo Maintainers: To accept this application, review their application or assign @Fury03 to this issue.
Congratulations, @Fury03! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on November 25, 2026.
🧑💻 @Fury03: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.
[!WARNING] When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.
🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.
🌊 Happy Wave 🌊
This issue has been completed by @Fury03 as part of the Stellar Wave Program's 11th Wave 🥳
😎 @Fury03: You earned 200 Points for completing this issue! Once the Wave's rewards are finalized, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here. You can also Leave a review to share your experience working on this issue.
🧑💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.