We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3f7a371 commit 8b467e9Copy full SHA for 8b467e9
1 file changed
data/src/main/java/com/moneymong/moneymong/data/pagingsource/AgencyPagingSource.kt
@@ -18,13 +18,13 @@ class AgencyPagingSource(
18
19
override suspend fun load(params: LoadParams<Int>): LoadResult<Int, AgencyGetResponse> {
20
val page = params.key ?: START_PAGE
21
- val size = params.loadSize
22
- return dataSource.getAgencies(page = page, size = size).fold(
+ val loadSize = params.loadSize
+ return dataSource.getAgencies(page = page, size = loadSize).fold(
23
onSuccess = {
24
LoadResult.Page(
25
data = it.agencies,
26
prevKey = null,
27
- nextKey = if (it.agencies.isEmpty()) null else page + 1
+ nextKey = if (it.agencies.size < loadSize) null else page + 1
28
)
29
},
30
onFailure = {
0 commit comments