Favouriting/low-priority a room doesn't move it in the sidebar until an unrelated re-render #20

Closed
opened 2026-09-12 01:50:54 -04:00 by jared · 0 comments
Owner

Severity: high · Type: bug · Confidence: medium

Location: src/app/pages/client/home/Home.tsx:257-354, src/app/features/room-nav/RoomNavItem.tsx:353-377

Problem

favoriteRooms/lowPriorityRooms/otherRooms are derived in a useMemo keyed only on [mx, rooms], where rooms comes from useHomeRooms() (backed by allRoomsAtom/roomToParentsAtom/mDirectAtom). None of those atoms are updated when a room's m.tag account-data changes — there is no listener anywhere in the codebase for RoomEvent/tag changes feeding into these atoms (grep for RoomEvent.Tags in src/app returns nothing). RoomNavItemMenu.handleToggleFavorite/handleToggleLowPriority call mx.setRoomTag/mx.deleteRoomTag directly, which mutates room.tags on the SDK's Room object but does not itself trigger any atom update. As a result, right-clicking a room and choosing "Add to Favorites" (or Low Priority) does not move the room into the Favorites/Low-Priority section, and the star icon in RoomNavItem does not appear, until some unrelated event causes rooms, roomToUnreadSet, or homeRoomSort to change (e.g. a new message arrives in some other room, changing the unread set) and forces the whole tree to re-render and pick up the mutated (but by-then possibly stale local-echo vs. server-confirmed) room.tags.

Lead review note: this is inherited upstream Cinny code; confirmed by reading that nothing subscribes to tag changes, but please confirm the symptom in the live app before fixing.

How to trigger

Right-click any room in the sidebar → "Add to Favorites". Observe the room stays in its original section and has no star icon until some other UI event forces a re-render (can take minutes on a quiet account, or never during the session).

Suggested fix

Subscribe to the SDK's room tags update (there's no dedicated RoomEvent for tags in js-sdk; account-data Room.accountData/sync events fire when m.tag room account data changes) and bump a counter/atom on tag changes so Home.tsx's categorisation memo re-runs — mirroring the pattern already used for roomToUnreadAtom.


Filed from the September 2026 client audit (branch lotus @ 4bea4895).

**Severity:** high · **Type:** bug · **Confidence:** medium **Location:** `src/app/pages/client/home/Home.tsx:257-354`, `src/app/features/room-nav/RoomNavItem.tsx:353-377` ### Problem `favoriteRooms`/`lowPriorityRooms`/`otherRooms` are derived in a `useMemo` keyed only on `[mx, rooms]`, where `rooms` comes from `useHomeRooms()` (backed by `allRoomsAtom`/`roomToParentsAtom`/`mDirectAtom`). None of those atoms are updated when a room's `m.tag` account-data changes — there is no listener anywhere in the codebase for `RoomEvent`/tag changes feeding into these atoms (`grep` for `RoomEvent.Tags` in `src/app` returns nothing). `RoomNavItemMenu.handleToggleFavorite`/`handleToggleLowPriority` call `mx.setRoomTag`/`mx.deleteRoomTag` directly, which mutates `room.tags` on the SDK's `Room` object but does not itself trigger any atom update. As a result, right-clicking a room and choosing "Add to Favorites" (or Low Priority) does not move the room into the Favorites/Low-Priority section, and the star icon in `RoomNavItem` does not appear, until some unrelated event causes `rooms`, `roomToUnreadSet`, or `homeRoomSort` to change (e.g. a new message arrives in some other room, changing the unread set) and forces the whole tree to re-render and pick up the mutated (but by-then possibly stale local-echo vs. server-confirmed) `room.tags`. **Lead review note:** this is inherited upstream Cinny code; confirmed by reading that nothing subscribes to tag changes, but please confirm the symptom in the live app before fixing. ### How to trigger Right-click any room in the sidebar → "Add to Favorites". Observe the room stays in its original section and has no star icon until some other UI event forces a re-render (can take minutes on a quiet account, or never during the session). ### Suggested fix Subscribe to the SDK's room tags update (there's no dedicated `RoomEvent` for tags in js-sdk; account-data `Room.accountData`/`sync` events fire when `m.tag` room account data changes) and bump a counter/atom on tag changes so `Home.tsx`'s categorisation memo re-runs — mirroring the pattern already used for `roomToUnreadAtom`. --- --- _Filed from the September 2026 client audit (branch `lotus` @ 4bea4895)._
jared added this to the Audit 2026-09 · High milestone 2026-09-12 01:50:54 -04:00
jared added the bugpriority: higharea: navigation labels 2026-09-12 01:50:54 -04:00
jared self-assigned this 2026-09-12 01:50:54 -04:00
jared closed this issue 2026-09-13 00:56:42 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
2026-10-14
Dependencies

No dependencies set.

Reference: LotusGuild/cinny#20