You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.
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
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.
Issues:
https://drive.google.com/drive/folders/14aOosTqeY747SajXxcgwTrzLwD51NZNP?usp=sharing
The text was updated successfully, but these errors were encountered: