mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
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:
@@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user