Skip to content

Commit bb524f0

Browse files
committed
task(ui): TimelineState::handle_remote_events_with_diffs adjusts the Skip's count.
This patch updates `TimelineState::handle_remote_events_with_diffs` to adjust the count value of the `Skip` higher-order stream.
1 parent e974ea8 commit bb524f0

File tree

1 file changed

+14
-0
lines changed
  • crates/matrix-sdk-ui/src/timeline/controller

1 file changed

+14
-0
lines changed

crates/matrix-sdk-ui/src/timeline/controller/state.rs

+14
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,23 @@ impl TimelineState {
9797
return;
9898
}
9999

100+
let previous_number_of_items = self.items.len();
101+
100102
let mut transaction = self.transaction();
101103
transaction.handle_remote_events_with_diffs(diffs, origin, room_data, settings).await;
102104
transaction.commit();
105+
106+
let next_number_of_items = self.items.len();
107+
108+
// Calculate the new count value for the `Skip` stream, used by the `Timeline`
109+
// subscriber.
110+
let count = self
111+
.meta
112+
.subscriber_skip_count
113+
.compute_next(previous_number_of_items, next_number_of_items);
114+
115+
// Update the count value for the `Skip` stream.
116+
self.meta.subscriber_skip_count.update(count, &self.timeline_focus);
103117
}
104118

105119
/// Marks the given event as fully read, using the read marker received from

0 commit comments

Comments
 (0)