-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Instant Search + Paging 3 + Flow #374
Comments
Hi @GautierLouis, that's because you are using
What you need is a terminal operator to trigger the flow to start listening for values, such as collect. The simplest way would using lifecycleScope.launch {
searchViewModel.problems.collect {
println("RESULT PROBLEM $it")
problemAdapter.submitData(it)
}
searchViewModel.areas.collect {
println("RESULT AREAS $it")
areaAdapter.submitData(it)
}
} |
Hi @aallam , |
Hi @GautierLouis, indeed paging3 and multisearch doesn't seem to work as expected, we have added this issue to our backlog. |
No worries, I've managed to do it with a basic subscriptions + flow, and I don't have any skills on compose yet. |
Describe the bug 🐛
I'm implementing Instant Search on my android app using Paging 3 and flow to update the UI
I followed this article : https://www.algolia.com/doc/api-reference/widgets/multi-hits/android/#examples
This is quite simple but, for some reason either flow or live data are not updated when a query is typed.
To Reproduce 🔍
My entire ViewModel ->
```
private val searcher = MultiSearcher(
applicationID = ApplicationID("-----"),
apiKey = APIKey("----")
)
private val pagingConfig = PagingConfig(pageSize = 50)
private val indexProblem = IndexName(INDEX_PROBLEM)
private val indexArea = IndexName(INDEX_AREA)
private val problemSearcher = searcher.addHitsSearcher(indexName = indexProblem)
private val areaSearcher = searcher.addHitsSearcher(indexName = indexArea)
private val filterState = FilterState()
private val connection = ConnectionHandler()
private val problemPaginator = Paginator(
problemSearcher,
pagingConfig,
transformer = { hit -> hit.deserialize(ProblemRemote.serializer()) }
)
private val areaPaginator = Paginator(
areaSearcher,
pagingConfig,
transformer = { hit -> hit.deserialize(AreaRemote.serializer()) }
)
}
The text was updated successfully, but these errors were encountered: