mirror of
https://github.com/SableClient/Sable.git
synced 2026-11-21 09:31:17 -08:00
fix(timeline): suppress dividers when the underlying event renders null
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.
This commit is contained in:
1 file changed
+8
-2
@@ -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 && (
|
||||
<MessageBase space={messageSpacing}>
|
||||
@@ -942,7 +948,7 @@ export function RoomTimeline({
|
||||
</MessageBase>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
) : null;
|
||||
|
||||
if (index === 0) {
|
||||
return (
|
||||
|
||||
Reference in new issue
Block a user