Status Update
Comments
ja...@abedatasolutions.com.ph <ja...@abedatasolutions.com.ph> #2
Hello, can you please attach a sample that reproduces your error?
cl...@google.com <cl...@google.com> #3
I’ve attached two screen recordings demonstrating the mediator's behavior during the first and second launches after installation. Additionally,
ja...@abedatasolutions.com.ph <ja...@abedatasolutions.com.ph> #4
Based on first_launch_after_installation.mp4
, your paging state is indeed showing null
for nextKey, so it makes sense that Paging concluded there are no more items to load.
So I think the question is why the PagingState
contains only an empty page and null
values. My guess is either
- RemoteMediator REFRESH actually returned empty data - what is the returned
allNewsItems
value on initial REFRESH? - RemoteMediator REFRESH successfully loaded data and inserted it into database, but Paging hasn't processed that yet by the time Append is triggered, so PagingState is empty.
The second case doesn't seem likely though.
If you attach an executable app, I can look into this further.
Otherwise, you may gain more insight through Paging logs with adb shell setprop log.tag.Paging VERBOSE
. You can also try implementing RemoteKeys
in this
cl...@google.com <cl...@google.com> #5
Hey! I ran into this same issue. It is in fact the second case you mentioned and is documented
I've published a repo
ja...@abedatasolutions.com.ph <ja...@abedatasolutions.com.ph> #6
I have the screen recording on
In Items Screen, the top of the list is Item #1
. When I switch to R1
, The top of the list is Item #4
. Once I switch to No Radius
, the current item on top is still Item #4
wherein there are more items on top and it is not directly noticed until you scroll up.
The LazyListState
is set to be re-initialized upon changes to the uiState
using the code below so the list should've been repositioned at the top.
val lazyListState = rememberSaveable(uiState, saver = LazyListState.Saver) {
LazyListState()
}
Description
Component used: Paging, Room Paging, Compose Paging Version used: 3.3.2
This is also posted in Room
I have here an
Item
and aHeader
. I cache them in the database then observe them in aLazyList
in the UI. TheHeader
acts as astickyHeader
and they need to follow a particular order in order to be displayed properly. To achieve that, I need to wrap them in asealed interface ItemModel
then be display them as anitem
or astickyHeader
according to the ItemModel.The
Item
andHeader
is observed inHeaderItemRelation
as aPagingSource
. They are then mapped throughHeaderItemRelationPagingDataMapper
then finally passed to the UI.I have filters for the Headers and Radius. If a
Header
is selected, theHeader
will not be included in the query.Now, when I switch the filters, a new list will be loaded in the UI. However, when you try switching to some filter wherein the result on top is the same, you may sometimes experience it moving up and displaying the 2nd Item instead of the 1st. And most of the time when switching filters, you are not on top of the list.