fix(direct): prevent double-badge on /direct/ icon for rooms in sidebar#289
Merged
Just-Insane merged 2 commits intodevfrom Mar 15, 2026
Merged
fix(direct): prevent double-badge on /direct/ icon for rooms in sidebar#289Just-Insane merged 2 commits intodevfrom
Just-Insane merged 2 commits intodevfrom
Conversation
The /direct/ icon badge was counting unread for all DMs, including those already displayed as individual avatar entries in the sidebar via DirectDMsList. This caused users to see duplicate badges — one on the avatar entry and one on the /direct/ icon — for the same room. Extract useSidebarDirectRoomIds hook (shared by DirectDMsList and DirectTab) that returns the room IDs currently shown as sidebar avatars. DirectTab now computes its badge only for DMs that overflow beyond the MAX_SIDEBAR_DMS (3) limit shown in the sidebar. Closes #235
Contributor
Deploying with
|
| Status | Preview URL | Commit | Alias | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! | https://pr-289-sable.raspy-dream-bb1d.workers.dev | f8bb692 | pr-289 |
Sun, 15 Mar 2026 18:56:47 GMT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #235
Problem
Users were seeing duplicate unread badges for the same DM room — one on the individual avatar entry in the sidebar (via
DirectDMsList) and a second one on the overall/direct/icon (viaDirectTab). Both were independently summing unread counts across all DMs, so rooms shown in the sidebar were counted twice.Solution
Extract a shared
useSidebarDirectRoomIdshook that encapsulates the logic for which DM room IDs are currently rendered as individual sidebar avatars (up to 3 most-recently-active unread DMs, gated on sync-ready state).DirectDMsListuses the hook directly, replacing its inline filtering/sorting/sync logic.DirectTabuses the hook to build an exclusion set (sidebarRoomIds), so its badge only counts DMs that overflow beyond the sidebar list (i.e., room a discord like rich presence #4+).Files changed
src/app/pages/client/sidebar/useSidebarDirectRoomIds.ts— new shared hooksrc/app/pages/client/sidebar/DirectDMsList.tsx— use shared hook, remove duplicated logicsrc/app/pages/client/sidebar/DirectTab.tsx— exclude sidebar rooms from badge count