fix(sync): Verify state for newly-left rooms is in incremental sync

This commit is contained in:
Erwan Leboucher authored and eleboucher committed 2026-07-21 18:32:34 +00:00
1 parent 4f1af01bdc
commit b144b18aef
2 files changed
+16 -1

No files matched your search

+1
View File
@@ -0,0 +1 @@
Fixed freshly left room failing to sync.
+15 -1
View File
@@ -230,7 +230,7 @@ async fn build_left_state_and_timeline(
.and_then(|limit| limit.try_into().ok())
.unwrap_or(DEFAULT_TIMELINE_LIMIT);
let timeline = load_timeline(
let mut timeline = load_timeline(
services,
syncing_user,
room_id,
@@ -240,6 +240,20 @@ async fn build_left_state_and_timeline(
)
.await?;
// the timeline index can lag behind the leave PDU, so `load_timeline` may omit
// it. we already hold the leave event, so ensure it's always synced to the
// client.
let leave_synced = timeline
.pdus
.iter()
.any(|(_, pdu)| pdu.event_id() == leave_membership_event.event_id());
if !leave_synced {
timeline
.pdus
.push_back((timeline_end_count, leave_membership_event));
}
let lazily_loaded_members =
prepare_lazily_loaded_members(services, sync_context, room_id, timeline.senders()).await;