rafsanahmad / RecyclerView-Paging-3.0

Paging 3 library demonstration using github search.
22 stars 5 forks source link

Why it is loading multiple page at start ?? #1

Open razi3742 opened 2 years ago

razi3742 commented 2 years ago

Hello,

first of all thanks for this awsome work. can you please tell me why in RemoteMediator it is calling multiple page at once. how we can restrict paging library to load only first page and then we have scroll to bottom then i can next page ??

rafsanahmad commented 1 year ago

In GithubRemoteMediator.kt

Try changing:

override suspend fun initialize(): InitializeAction {
        return InitializeAction.LAUNCH_INITIAL_REFRESH
    }

Use: return InitializeAction.SKIP_INITIAL_REFRESH

InitializeAction used to control whether load with load type REFRESH will be immediately dispatched when the first PagingData is submitted:

Documentation: https://developer.android.com/reference/kotlin/androidx/paging/RemoteMediator#initialize()