Change theme
Help
Press space for more information.
Show links for this issue (Shortcut: i, l)
Copy issue ID
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
Vote: I am impacted
Notification menu
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Pending code changes (auto-populated)
View issue level access limits(Press Alt + Right arrow for more information)
Request for new functionality
View staffing
Description
Problem
Currently, Paging flows are collected through
collectAsLazyPagingItems
. The API does not provide a way to specify which coroutine context to use, that leads to collecting the flow on the main thread.the transformation happening on the flow (e.g.
pagingData.map
can be costly and would add up), ideally host app should be able to specify where that runs.right now, the Java api allows to specify an Executor. I believe the same cannot be achieved through the kotlin overload:
pagingData.map
with a context does not propagate (pseudocode):Note that it would be the same behavior if
flowOn
was used to specify another coroutineContext.pagingData.map
would still execute on main thread.pagingData.map
works but results in someProposal
collectAsLazyPagingItems
should take an optional coroutine context and use it like:Where the default value for
coroutineContext
should be backward compatible with current behavior.