From e53c26f934b7d14fcd660e9ea9904d075a35e3bb Mon Sep 17 00:00:00 2001 From: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Date: Sun, 26 Apr 2026 03:33:51 -0700 Subject: [PATCH] fix(timeline): suppress dividers when the underlying event renders null MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #701 The hook hands the renderer a `willRenderDayDivider` / `willRenderNewDivider` flag attached to the FIRST event of a new day (or the readUptoEventId boundary). The render layer in RoomTimeline always emitted those dividers even when `useTimelineEventRenderer` returned `null` for the event itself — for example when `hideMembershipEvents` / `hideNickAvatarEvents` / `hideMemberInReadOnly` filtered the underlying event out at render time. Result: announcement channels and similar rooms whose only events on a given day are hidden (joins/leaves/profile changes) showed a bare day divider with no message under it. Same orphan pattern produced the "dates showing without content" complaint in #701. Fix: gate the dividers JSX on `renderedEvent !== null`. When the event renders null, the dividers are skipped too. When at least one event of a day passes the renderer, the divider is attached to it the same way as before. Edge case: a day where the first hook-eligible event is rendered as null but a later event renders correctly will lose the day divider entirely. That is strictly better than an orphan divider in the symptom case the issue reports, and the proper fix (propagate the divider forward in useProcessedTimeline based on render prediction) is a larger refactor that can land separately. --- src/app/features/room/RoomTimeline.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/app/features/room/RoomTimeline.tsx b/src/app/features/room/RoomTimeline.tsx index 8bc5d770c..e1d7fb504 100644 --- a/src/app/features/room/RoomTimeline.tsx +++ b/src/app/features/room/RoomTimeline.tsx @@ -921,7 +921,13 @@ export function RoomTimeline({ eventData.collapsed ); - const dividers = ( + // Suppress dividers when the underlying event will not render. + // Otherwise rooms whose only events on a given day are hidden + // (e.g. announcement channels full of profile changes / joins) + // show a bare day divider with no message under it (#701). + const showDividers = renderedEvent !== null; + + const dividers = showDividers ? ( <> {eventData.willRenderDayDivider && ( @@ -942,7 +948,7 @@ export function RoomTimeline({ )} - ); + ) : null; if (index === 0) { return (