mirror of
https://github.com/element-hq/element-x-ios.git
synced 2025-03-11 13:59:13 +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() {
|
private func loadNextPage() {
|
||||||
|
guard !state.isLoading else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
Task {
|
Task {
|
||||||
state.isLoading = true
|
state.isLoading = true
|
||||||
let _ = await roomDirectorySearchProxy.nextPage()
|
let _ = await roomDirectorySearchProxy.nextPage()
|
||||||
|
@ -40,15 +40,13 @@ struct RoomDirectorySearchScreen: View {
|
|||||||
.foregroundColor(.compound.textSecondary)
|
.foregroundColor(.compound.textSecondary)
|
||||||
.frame(maxWidth: .infinity)
|
.frame(maxWidth: .infinity)
|
||||||
.accessibilityIdentifier(A11yIdentifiers.startChatScreen.searchNoResults)
|
.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
|
emptyRectangle
|
||||||
.onAppear {
|
.onAppear {
|
||||||
context.send(viewAction: .reachedBottom)
|
context.send(viewAction: .reachedBottom)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
.listRowSeparator(.hidden)
|
.listRowSeparator(.hidden)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user