mirror of
https://github.com/element-hq/element-x-ios.git
synced 2025-03-10 13:37:11 +00:00
Fix interminable room directory search next page loading loops when results don't fill the screen
This commit is contained in:
parent
dc9eb868d6
commit
261cb366a7
@ -104,6 +104,10 @@ class RoomDirectorySearchScreenViewModel: RoomDirectorySearchScreenViewModelType
|
||||
}
|
||||
|
||||
private func loadNextPage() {
|
||||
guard !state.isLoading else {
|
||||
return
|
||||
}
|
||||
|
||||
Task {
|
||||
state.isLoading = true
|
||||
let _ = await roomDirectorySearchProxy.nextPage()
|
||||
|
@ -40,14 +40,12 @@ struct RoomDirectorySearchScreen: View {
|
||||
.foregroundColor(.compound.textSecondary)
|
||||
.frame(maxWidth: .infinity)
|
||||
.accessibilityIdentifier(A11yIdentifiers.startChatScreen.searchNoResults)
|
||||
} else {
|
||||
// This needs to be in the else as when you start a search, the results are cleared making the footer visible.
|
||||
// We only want to trigger the pagination when the state is not loading.
|
||||
emptyRectangle
|
||||
.onAppear {
|
||||
context.send(viewAction: .reachedBottom)
|
||||
}
|
||||
}
|
||||
|
||||
emptyRectangle
|
||||
.onAppear {
|
||||
context.send(viewAction: .reachedBottom)
|
||||
}
|
||||
}
|
||||
.listRowSeparator(.hidden)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user