Fix room pickers not loading more than the first page of rooms

The forward, share, add-to-space and search pickers signal reaching the
bottom of the list with an empty `roomCount..<roomCount` range. The
prefetch sink added in 9dd9fd917 guards on `!range.isEmpty` to skip the
initial `0..<0`, which also dropped the pickers' bottom signal, so they
never loaded past the first 100 rooms.

Only skip `0..<0` instead, which leaves the home screen prefetch as it
was, and cover the bottom, prefetch and top cases in
RoomSummaryProviderTests.
This commit is contained in:
Mauro Romito
2026-10-12 10:39:19 +02:00
committed by Mauro
parent 1609bbbf81
commit f99b607f08
2 changed files with 78 additions and 2 deletions
@@ -192,7 +192,8 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
visibleItemRangePublisher
.sink { [weak self] range in
guard let self,
!range.isEmpty,
// Pickers send an empty `count..<count` range when reaching the bottom, so only ignore `0..<0` (the initial value or the top).
range.upperBound > 0,
range.upperBound >= rooms.count - Int(roomListPageSize) / 2,
rooms.count != roomCountOnLastPageAddRequest else {
return