Status Update
Comments
an...@google.com <an...@google.com> #2
Branch: androidx-master-dev
commit b90079595f33f58fece04026a97faa0d243acdb1
Author: Yuichi Araki <yaraki@google.com>
Date: Wed Sep 18 16:55:49 2019
Change the way to detect mismatch between POJO and query
This fixes cursor mismatch warnings with expandProjection.
Bug: 140759491
Test: QueryMethodProcessorTest
Change-Id: I7659002e5e0d1ef60fc1af2a625c0c36da0664d8
M room/compiler/src/main/kotlin/androidx/room/processor/QueryMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
M room/compiler/src/main/kotlin/androidx/room/solver/query/result/PojoRowAdapter.kt
M room/compiler/src/test/kotlin/androidx/room/processor/QueryMethodProcessorTest.kt
M room/compiler/src/test/kotlin/androidx/room/testing/TestProcessor.kt
du...@google.com <du...@google.com> #3
du...@google.com <du...@google.com> #4
Branch: androidx-master-dev
commit bdde5a1a970ddc9007b28de4aa29d60ffa588f08
Author: Yigit Boyar <yboyar@google.com>
Date: Thu Apr 16 16:47:05 2020
Re-factor how errors are dismissed when query is re-written
This CL changes how we handle errors/warnings if query is
re-written.
There was a bug in expandProjection where we would report warnings
for things that Room already fixes automatically (
The solution to that problem (I7659002e5e0d1ef60fc1af2a625c0c36da0664d8)
solved it by deferring validating of columns until after re-write
decision is made. Unfortunately, this required changing PojoRowAdapter
to have a dummy mapping until it is validating, make it hard to use
as it does have a non-null mapping which is not useful.
This CL partially reverts that change and instead rely on the log
deferring logic we have in Context. This way, we don't need to break
the stability of PojoRowAdapter while still having the ability to
drop warnings that room fixes. This will also play nicer when we
have different query re-writing options that can use more information
about the query results.
Bug: 153387066
Bug: 140759491
Test: existing tests pass
Change-Id: I2ec967c763d33d7a3ff02c1a13c6953b460d1e5f
M room/compiler/src/main/kotlin/androidx/room/log/RLog.kt
M room/compiler/src/main/kotlin/androidx/room/processor/QueryMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
M room/compiler/src/main/kotlin/androidx/room/solver/query/result/PojoRowAdapter.kt
an...@google.com <an...@google.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
il...@google.com <il...@google.com>
ap...@google.com <ap...@google.com> #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
ki...@protonmail.com <ki...@protonmail.com> #7
al...@mercari.com <al...@mercari.com> #8
Is this the same issue reported in
du...@google.com <du...@google.com> #9
Is this the same issue reported in
which was set as Won't Fix? Because we did follow the recommendation from there to skip the first state, so we will have to revert that code. https://issuetracker.google.com/issues/190788885
Yes, part of the intention here is that people will no longer need to add this workaround in their code.
ha...@gmail.com <ha...@gmail.com> #10
Let's take a search screen example. When the user first enters the search screen, nothing is loading until the user enters its search in the textfield then clicks the search button. Then the state should be Loading.
I guess we should use the workaround provided here
ma...@gmail.com <ma...@gmail.com> #11
It might be too late for some people, but if people want to know how to tackle this I've played around with it on a pet project ( didn't test this in a prod environment, so a heads up there ):
@Composable
fun <T : Any> LazyPagingItems<T>.refreshLoadState(): State<LoadState> = produceState<LoadState>(
LoadState.NotLoading(false),
) {
snapshotFlow { loadState }
.drop(1)
.map { it.refresh }
.collect { value = it }
}
cl...@google.com <cl...@google.com> #12
Re
Given the most common use case displays paged data right away, defaulting LoadState to Loading
means the most common use case will not have to drop first LoadState (versus if it were NotLoading).
re...@gmail.com <re...@gmail.com> #13
I don't get how initial state being anything would affect the use case of displaying paged data right away. Wouldn't the LoadState
change before the user has time to notice?
IMHO, initial state being NotLoading
would be the sanest choice. In the case of waiting before starting to load data, the correct state would be shown to the user and in the case of loading data right away, it would immediately change to Loading
, so the correct state would be shown to the user in this case as well.
du...@google.com <du...@google.com>
cl...@google.com <cl...@google.com> #14
Re collectAsLazyPagingItems
compose launches collection on Pager right away. By the time pager.collectAsLazyPagingItems()
returns, data is loading, so initial Loading
is the correct state.
Initializing with NotLoading
also causes other issues (which is why Paging with Views was also refactored to not initialize with NotLoading):
- For users who rely on first
NotLoading
state as indication of refresh complete, they have to manually filter out the firstNotLoading
- If loading animation (i.e. spinners) are based on LoadStates, you could end up seeing a blank screen --> spinner --> data loaded in, and that is not a good user experience.
Description
In Paging 3.1 we made the behavior change to always wait for real
LoadState
updates fromPagingSource
/RemoteMediator
before sending them downstream to user. This allows a developer to react on page loads without needing to filter out the initial / intermediateNotLoading
states. This also prevents sending aCombinedLoadStates
wheremediator
states isnull
even though we are usingRemoteMediator
.Ideally we would not send any "initial" load state downstream, I'm not sure if that means we need to make
.loadState
nullable inLazyPagingItems
as it may not be idiomatic for Compose.Note that this initial state will also end up affecting invalidation, retry, recompose, etc.