Skip to content

feat(room-nav): show topic and last-message preview for rooms in the sidebar#669

Open
Just-Insane wants to merge 3 commits intoSableClient:devfrom
Just-Insane:feat/room-message-preview
Open

feat(room-nav): show topic and last-message preview for rooms in the sidebar#669
Just-Insane wants to merge 3 commits intoSableClient:devfrom
Just-Insane:feat/room-message-preview

Conversation

@Just-Insane
Copy link
Copy Markdown
Contributor

Description

Extends the room navigation sidebar so that non-DM rooms also display a topic or last-message preview beneath the room name — mirroring the DM list preview added in #666.

  • useRoomLastMessage — new hook that scans the live timeline in reverse to find the most recent visible message event (skipping reactions, redactions, and state events) and returns a human-readable preview string. Handles encrypted events (updates when decryption resolves), sender prefixing, and common content types (text, attachments, stickers, polls, etc.).
  • Sidebar integrationSpaceItems and the home-room list pass the preview down to each NavItem component.
  • Sliding sync fixLIST_TIMELINE_LIMIT increased from 1 to 5. With only 1 event, the SDK's eventShouldLiveIn() drops reactions and edits from the live timeline (their parent event is absent in the single-event batch), leaving the timeline empty. Fetching 5 events ensures the parent is almost always present so previews work for unvisited rooms.

Fixes #

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

AI disclosure:

  • Partially AI assisted (clarify which code was AI assisted and briefly explain what it does).

useRoomLastMessage.ts — the reverse-scan loop and event-type dispatch table were drafted with AI assistance and then reviewed against the Matrix spec and existing hook patterns in the codebase. The sliding-sync LIST_TIMELINE_LIMIT diagnosis and fix were done manually after investigating the SDK's eventShouldLiveIn() behaviour.

…iews

With timeline_limit: 1, if the latest event is a reaction or edit, the SDK
drops it from getLiveTimeline() because it cannot resolve the parent event
from a single-event batch. This leaves the timeline empty and breaks the
room message preview. Fetching 5 events ensures the parent message is
present alongside reactions/edits so the SDK places them correctly and
getLastMessageText finds a displayable preview.
@Just-Insane Just-Insane requested review from 7w1 and hazre as code owners April 12, 2026 16:12
@Just-Insane Just-Insane deleted the feat/room-message-preview branch April 12, 2026 19:33
@Just-Insane Just-Insane restored the feat/room-message-preview branch April 12, 2026 19:41
@Just-Insane Just-Insane reopened this Apr 12, 2026
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.

1 participant