I came across this conversation <https://kotlinlan...
# mvikotlin
t
I came across this conversation https://kotlinlang.slack.com/archives/C03H3N51SKT/p1698928801062839?thread_ts=1698876714.658139&amp;cid=C03H3N51SKT when attempting to use MVIKotlin with Decompose in an application which already is using Flow<PagingData<T>> returned from Repositories. Paging3 library is sprinkled around the application, specifically PagingData and also collectAsLazyingPagingItem in Composable functions. I'm not certain I want to remove the use of Paging3 library but it does seems the API doesn't work well at all with MVI. The solution I've come up with is to have the Decompose Component return separate flows if they contain paging data. It's not idea since logic is both in the Decompose Component and MVI Store. I'm curious if there is an example to use as a reference where Paging3 isn't used but instead a "LoadMore" intent is passed to the Store. This obviously has implications on the Repository interface but just curious how others have solved this problem.
a
I don't remember any public examples, but usually it's as simple as in the linked thread. Add an isLoadingMore flag to your state, add a LoadMore intent, check the flag before loading, call your repository and pass there an offset based on the current list size (or a cursor string also stored in the state), then append new items to the state and clear the flag.
t
Thanks for the reply. I got there in the end. It was actually pretty easy on the Repository and Store part. It was a bit trickier integrating with Compose.
👍 1
But yes, Just adding a new intent and a new field to the state was really all you need.