Status Update
Comments
cl...@google.com <cl...@google.com> #2
Hello, can you please attach a sample that reproduces your error?
ly...@gmail.com <ly...@gmail.com> #3
I’ve attached two screen recordings demonstrating the mediator's behavior during the first and second launches after installation. Additionally,
ly...@gmail.com <ly...@gmail.com> #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
ly...@gmail.com <ly...@gmail.com> #6
That makes sense to me if it's load from remote. Local source intended very short time to prepend/append, that's why UI flashing.
cl...@google.com <cl...@google.com> #7
Then you should set TerminalSeparatorType.FULLY_COMPLETE
instead of TerminalSeparatorType.SOURCE_COMPLETE
.
SOURCE_COMPLETE
means it will show footer and header once local sources is complete.
ly...@gmail.com <ly...@gmail.com> #8
With TerminalSeparatorType.FULLY_COMPLETE
, still flashing.
List updates in less than 100ms.
Logcat:
Refresh l=[0, 1, 2]
flow: 0 * 1 * 2
Prepend l=[]
flow: * 0 * 1 * 2
Are you trying to get the header and footer to show regardless of load state? i.e. Show footer and header even if there is more to load on either end?
This is what I'm trying to do:
Refresh l=[0, 1, 2]
flow: * 0 * 1 * 2 < Separator will appear in a very short time, so DON'T disappear here.
Prepend l=[]
flow: * 0 * 1 * 2
ly...@gmail.com <ly...@gmail.com> #9
I have to collectLatest itemSnapshotList
directly and add some delay to it. The spearator disappear and appear problem will be fixed. But not for first time load, because prepend only triggered after showing.
cl...@google.com <cl...@google.com> #10
Separator will appear in a very short time, so DON'T disappear here.
It's not that the separator disappeared. The very first separator (the one before 0
) is a endOfPagination = true
.
So the sequence is:
Refresh l=[0, 1, 2]
insert separators after `0`, and `1`, resulting in [0 * 1 * 2]
Prepend l=[], endOfPagination = true
insert separator before `0`, resulting in [* 0 * 1 * 2]
So it seems like what you want is for the header and footer to show, regardless of whether there is more to load in that direction?
ly...@gmail.com <ly...@gmail.com> #11
It's not just as a footer or header. Load state changes very fast, so in this case, the terminal separator flicking is very annoying.
So it seems like what you want is for the header and footer to show, regardless of whether there is more to load in that direction?
For boolean answer, Yes.
Description
Once refresh the list, footer/header spearator will disappear and appear again, it causes UI flashing.
Code like the:
flow.insertSeparators(TerminalSeparatorType.SOURCE_COMPLETE){ _,_ -> "*" }
Do refresh:
PagingSource Refresh
[1 2 3]
insertSeparators
insertSeparators
Flow emit this to UI,
[1 * 2 * 3]
PagingSource Prepend
PagingSource Append
insertSeparators
Flow emit this to UI,
[1 * 2 * 3 *]
insertSeparators
Flow emit this to UI,
[* 1 * 2 * 3 *]