Update subscriptions if visible range rooms change without the range itself changing (#3220)

* Remove room list range deduplication and allow subscribing to rooms when then update to come into the visible range.

* Fixes #3088 - Update subscriptions if visible range rooms change without the range itself changing
- we switched from range based subscribing with duplicate suppression to id based, but ids can change without ranges changing
- the all rooms list fetches at least 1 event per rooms and can cause rooms to come in and out of the visible range without user interaction
This commit is contained in:
Stefan Ceriu
2024-09-02 18:35:31 +03:00
committed by GitHub
parent 062811cac4
commit 288b1e7896
4 changed files with 67 additions and 78 deletions
@@ -200,6 +200,8 @@ struct HomeScreenContent: View {
private func delayedUpdateVisibleRange() {
guard let scrollView = scrollViewAdapter.scrollView,
scrollViewAdapter.isScrolling.value == false, // Ignore while scrolling
context.searchQuery.isEmpty == true, // Ignore while filtering
context.viewState.visibleRooms.count > 0 else {
return
}
@@ -215,6 +217,6 @@ struct HomeScreenContent: View {
let lastIndex = Int(max(0.0, scrollView.contentOffset.y + scrollView.bounds.height) / cellHeight)
// This will be deduped and throttled on the view model layer
context.send(viewAction: .updateVisibleItemRange(range: firstIndex..<lastIndex, isScrolling: scrollViewAdapter.isScrolling.value))
context.send(viewAction: .updateVisibleItemRange(firstIndex..<lastIndex))
}
}