This is an idea I have to load the feed lazily given the current infrastructure.
When we request a feed, we have a list of ID's, so we can populate our LazyList with a bunch of Loading State items.
Whenever I Loading State item comes into the Composition, it launches a SideEffect which will call up to the ViewModel to fetch that item. This seems like a decent approach without having to explicitly manage a paging mechanism in the ViewModel.
After second thought, I think the better approach is paging. And since we don't have actual paging via the API, we can simulate it.
Created a simple repository layer which wraps the actual base client, and adds the ability to request pages.
The requests are still sequential, but that can be updated later to be a series of async requests.
Some rationale here is that although with first approach we can keep scrolling, a fling will cause a bunch of network requests which could end up being quite costly.
The only thing that is a bit funky is the LazyList detecting how close we are to the end logic. I think this solution works but it probably needs more testing.
After second thought, I think the better approach is paging. And since we don't have actual paging via the API, we can simulate it.
Created a simple repository layer which wraps the actual base client, and adds the ability to request pages. The requests are still sequential, but that can be updated later to be a series of async requests.
Some rationale here is that although with first approach we can keep scrolling, a fling will cause a bunch of network requests which could end up being quite costly.
The only thing that is a bit funky is the LazyList detecting how close we are to the end logic. I think this solution works but it probably needs more testing.