-
Notifications
You must be signed in to change notification settings - Fork 271
Closed
Description
val page = when (loadType) {
LoadType.PREPEND -> {
val remoteKeys = getRemoteKeyForFirstItem(state)
if (remoteKeys == null) {
// The LoadType is PREPEND so some data was loaded before,
// so we should have been able to get remote keys
// If the remoteKeys are null, then we're an invalid state and we have a bug
throw InvalidObjectException("Remote key and the prevKey should not be null")
}
// If the previous key is null, then we can't request more data
val prevKey = remoteKeys.prevKey
if (prevKey == null) {
return MediatorResult.Success(endOfPaginationReached = true)
}
remoteKeys.prevKey
}
}
- The
throwstatement above says "Remote key and the prevKey should not be null", but you only test onremoteKey's nullability, not theprevKey. Please change to correct message or behavior - The latter
ifstatement testsprevKey, in a separate value. That is in principle not necessary, please omit theprevKeyvalue and test onremoteKeys.prevKeyinstead.
RG
doilio, gotamafandy, vaidadry and wseme-kiswe
Metadata
Metadata
Assignees
Labels
No labels