Open anderscheow opened 3 years ago
I encounter the same scenario where in subsequent page does not load only page 1, the reason because list table must align to remoteKeys table, take a look on Mediator code the getKeyForLastItem, getKeyForFirstItem, getKeyToCurrentPosition
`database.remoteKeysDao().remoteKeysRepoId(userDB.id)`
the paging uses 2 tables to cache the list, your list table and remotekeys table.
example:
UserDB
----------------------------------------------- Remotekeys
@PrimaryKey(autoGenerate = true)
@PrimaryKey(autoGenerate = true)
val uid: Int
---------------------------------- val repoId: Int
val id: Int
------------------------------------ val prevKey: Int
In above example the UserDB has two Ids uid which is the autogenerated int when you insert a value in UserDB table, and the val id: int which is the list Id from your api endpoint. During loading data to mediator you are using the val id: Int to create or insert RemoteKeys repoId, prevKey and nextKey. Make sure you are using the same Id in remotekeys and userDB. If I change the database.remoteKeysDao().remoteKeysRepoId(userDB.uid)
I will only get page 1 with no subsequent pages. As uid is not equal to repoId which is the val id: int of UserDB.
@anderscheow Facing the same issue. Any update about the issue
Issues:
https://drive.google.com/drive/folders/14aOosTqeY747SajXxcgwTrzLwD51NZNP?usp=sharing