Skip to content

Conversation

@ruffCode
Copy link

On initial app start, GithubRemoteMediator's load function is called with LoadType.REFRESH, the keys and repos are saved to Room. When it is immediately called again with LoadType.PREPEND, the call to getRemoteKeyForFirstItem returns null and InvalidObjectException is thrown. On app restart, the keys are present and no errors are thrown.

I am sure that this is not the optimal solution and would appreciate any feedback or guidance.

Thanks much!

-Alexi

…nction is called with LoadType.REFRESH, the keys and repos are saved to Room. When it is immediately called again with LoadType.PREPEND, the call to getRemoteKeyForFirstItem returns null and InvalidObjectException is thrown. On app restart, the keys are present and no errors are thrown
@iamarjun
Copy link

I also faced the same issue, but when I rolled back to the previous version of paging and room, the issue was fixed, btw, can you explain your solution?

Comment on lines +55 to 57
val remoteKeys = flowOf(getRemoteKeyForFirstItem(state))
.flowOn(Dispatchers.IO).single()
if (remoteKeys == null) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still crash on first launch

@adam-hurwitz
Copy link

I've created the pull request, fix: RemoteMediator #112, in order to resolve this issue by disabling the Prepend load which is not being used, and to set a default value for the first load of the Append load type.

@ruffCode ruffCode closed this Sep 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants