Skip to content

Commit 3c59d3b

Browse files
committed
event cache: add support for running back-pagination
1 parent b7d6fd0 commit 3c59d3b

File tree

6 files changed

+1101
-66
lines changed

6 files changed

+1101
-66
lines changed

crates/matrix-sdk-ui/src/room_list_service/room.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,10 @@ impl Room {
168168
.add_initial_events(
169169
self.inner.room.room_id(),
170170
self.inner.sliding_sync_room.timeline_queue().iter().cloned().collect(),
171+
self.inner.sliding_sync_room.prev_batch(),
171172
)
172173
.await?;
173174

174-
Ok(Timeline::builder(&self.inner.room)
175-
.with_pagination_token(self.inner.sliding_sync_room.prev_batch())
176-
.track_read_marker_and_receipts())
175+
Ok(Timeline::builder(&self.inner.room).track_read_marker_and_receipts())
177176
}
178177
}

crates/matrix-sdk-ui/src/timeline/tests/pagination.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use super::TestTimeline;
2222
use crate::timeline::{inner::HandleBackPaginatedEventsError, pagination::PaginationTokens};
2323

2424
#[async_test]
25-
async fn back_pagination_token_not_updated_with_empty_chunk() {
25+
async fn test_back_pagination_token_not_updated_with_empty_chunk() {
2626
let timeline = TestTimeline::new();
2727

2828
timeline
@@ -65,7 +65,7 @@ async fn back_pagination_token_not_updated_with_empty_chunk() {
6565
}
6666

6767
#[async_test]
68-
async fn back_pagination_token_not_updated_invalid_event() {
68+
async fn test_back_pagination_token_not_updated_invalid_event() {
6969
let timeline = TestTimeline::new();
7070

7171
// Invalid empty event.

crates/matrix-sdk-ui/tests/integration/timeline/sliding_sync.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -258,14 +258,14 @@ async fn timeline_test_helper(
258258
// TODO: when the event cache handles its own cache, we can remove this.
259259
client
260260
.event_cache()
261-
.add_initial_events(room_id, sliding_sync_room.timeline_queue().iter().cloned().collect())
261+
.add_initial_events(
262+
room_id,
263+
sliding_sync_room.timeline_queue().iter().cloned().collect(),
264+
sliding_sync_room.prev_batch(),
265+
)
262266
.await?;
263267

264-
let timeline = Timeline::builder(&sdk_room)
265-
.with_pagination_token(sliding_sync_room.prev_batch())
266-
.track_read_marker_and_receipts()
267-
.build()
268-
.await?;
268+
let timeline = Timeline::builder(&sdk_room).track_read_marker_and_receipts().build().await?;
269269

270270
Ok(timeline.subscribe().await)
271271
}

0 commit comments

Comments
 (0)