Skip to content

Commit

Permalink
Fixes #3026, fixes #2386 - Force update the home screen every time th…
Browse files Browse the repository at this point in the history
…e room list changes by manually moving the inner scrollview
  • Loading branch information
stefanceriu committed Aug 6, 2024
1 parent 0c9da2c commit 4e4d9f2
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions ElementX/Sources/Screens/HomeScreen/View/HomeScreenContent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,27 @@ struct HomeScreenContent: View {
}
.onChange(of: context.viewState.visibleRooms) { _ in
updateVisibleRange()

// We have been seeing a lot of issues around the room list not updating properly after
// rooms shifting around:
// * Tapping on the room list doesn't always take you to the right room - https://github.com/element-hq/element-x-ios/issues/2386
// * Big blank gaps in the room list - https://github.com/element-hq/element-x-ios/issues/3026
//
// We initially thought it's caused by the filters header or the geometry reader but
// the problem is still reproducible without those.
//
// As a last attempt we will manually force it to update by shifting the
// inner scroll view by a point every time the room list is updated
DispatchQueue.main.async {
guard !scrollViewAdapter.isScrolling.value, let scrollView = scrollViewAdapter.scrollView else {
return
}

var offset = scrollView.contentOffset
offset.y += 1

scrollView.setContentOffset(offset, animated: false)
}
}
.background {
Button("") {
Expand Down

0 comments on commit 4e4d9f2

Please sign in to comment.