Status Update
Comments
dr...@gmail.com <dr...@gmail.com> #2
Are you saying that loadState being null is more correct initial state compared to the current
```
CombinedLoadStates(
refresh = InitialLoadStates.refresh,
prepend = InitialLoadStates.prepend,
append = InitialLoadStates.append,
source = InitialLoadStates
)
private val IncompleteLoadState = LoadState.NotLoading(false)
private val InitialLoadStates = LoadStates(
IncompleteLoadState,
IncompleteLoadState,
IncompleteLoadState
)
```
vi...@google.com <vi...@google.com> #3
Ideally we would not pass any initial state because it will always have some case where it is wrong - we should ideally wait for a real event from Paging before sending it downstream to user.
For example the initial state:
CombinedLoadStates(
refresh = InitialLoadStates.refresh,
prepend = InitialLoadStates.prepend,
append = InitialLoadStates.append,
source = InitialLoadStates
)
...will always have null
mediator states, even if they are using RemoteMediator. This can mess up loadstate logic that is waiting for some combination of source + mediator loads to happen. It's easy to filter the initial case, but it gets complicated if they want to switchMap between multiple streams and they all start with this initial state. Or also consider the case when coming from cached state and needing to filter this out... it's bad developer UX.
So we could either set this to nullable to denote "no state" or we could have some constant we use that can be easily filtered out like "BogusLoadState" and then people can do .filter { it !== BogusLoadState }
ls...@google.com <ls...@google.com> #4
Alternatively, if we can read whether we have RemoteMediator
or not, we could try this for initial state which would be a lot more accurate:
private val InitialLoadStates = LoadStates(
LoadState.Loading,
IncompleteLoadState,
IncompleteLoadState
)
CombinedLoadStates(
refresh = InitialLoadStates.refresh,
prepend = InitialLoadStates.prepend,
append = InitialLoadStates.append,
source = InitialLoadStates,
mediatr = ??
)
dr...@gmail.com <dr...@gmail.com> #5
Don't you mind trying it out? You are better person for figuring out how to get RemoteMediator from PagingDataDiffer. To be honest I don't even know what RemoteMediator is used for
an...@antric.net <an...@antric.net> #6
Branch: androidx-main
commit b7f9085d0b13af5a346d0712bbf3bc5a680c2fc9
Author: Sanura N'Jaka <sanura@google.com>
Date: Thu Apr 28 22:10:36 2022
Changing LazyPagingItem's inital LoadState refresh to Loading
Rather than LazyPagingItem having the inital LoadState
refresh being set to LoadState.NotLoading, we want it
to be LoadState.Loading
RelNote: "`LazyPagingItems` now sets the initial
`loadState` to have a `LoadState.Loading` refresh."
Test: lazyPagingInitialLoadState
Fixes: 224855902
Change-Id: I55043244f92c8029e4667df2e23c5813dcf2f729
M paging/paging-compose/src/main/java/androidx/paging/compose/LazyPagingItems.kt
M paging/paging-compose/src/androidTest/java/androidx/paging/compose/LazyPagingItemsTest.kt
Description
I'm on a Pixel 6 Pro running the May 2022 update, but the issue began several months ago (I believe with the February update?). I don't know which other devices are affected.
For several months now, the app switcher randomly focuses the previous app instead of the one that was already open. This video (shared with the bugreport address) demonstrates the issue. You can see that opening the app switcher by tapping the button sometimes focuses the Settings app, which is the behavior I expect, but it sometimes focuses the previous app (my screen recorder) instead. I've found that it reproduces nearly every time if I quickly tap the app switcher button after opening an app fresh (you can see that I repro'd it in the video by swiping the Settings app away to close it, then tapping the app switcher button right after reopening it), but this doesn't work 100% of the time.
The inconsistency is incredibly frustrating, as I never know in advance where I'll need to swipe to close an app, and I frequently close the wrong one.