Closed antonis closed 3 years ago
I was able to reproduce this by scrolling quickly, but also when opening the app for the first time after a couple days.
Scrolling quickly:
Opening the app for the first time in a bit:
I was also able to reproduce this by clearing cache and stored data, then restarting my phone.
It's particularly scary opening the app for the first time in a while, as it has that "I lost all my posts!" sensation.
Reproduced the You haven't published any posts yet
situation by scrolling down through a large number of blog posts. Not attaching any video since I don't have a proper test website with enough posts in it, and used one of the A8C P2s to reproduce this.
Samsung A31, Android 10, WPAndroid 17.6.-rc-3
Looks like it started happening after migrating to Paging3
library v3.0.0
for the new unified comments list here:
https://github.com/wordpress-mobile/WordPress-Android/commit/9095c66e5fedac1bd5567cfb554e257fca4e2009 in #14709.
As per this migration guide
Paging 3 is significantly different from earlier versions of the Paging library.
Posts screen uses Paging2
(PagedListAdpter
), it is possible that Paging2
is not working well alongside this new version even though this Android ticket mentions:
The new version includes all methods and classes from the old, just deprecated.
I can start migrating Posts screen to use Paging 3, but it might not be straightforward considering Paging3
is almost a rewrite of Paging2
. @khaykov, keeping you in the loop 🙂 as I might need your help with this.
I'll also try a workaround around this part in FluxC tomorrow with a fresh mind for a possible beta fix.
👋 @antonis @thehenrybyrd !
I was also able to reproduce the You haven't published any posts yet
both:
Blog Posts
, no blog posts are available although I know they are, orBlog Posts
screen (PUBLISHED
tab).I used the AFK P2
site to get a large amount of blog posts to scroll through.
Google Pixel 4, Android S (12), WPAndroid 17.6.-rc-3
@ashiagr Sure, I'll be happy to help! I totally missed that the Post list is using Paging 2 🤦
Expected behavior
The posts list refreshes in all cases
Actual behavior
The post list fails to refresh when you scroll down too quickly (sometimes causing a crash) or after cleaning the cache
Unable to refresh
https://user-images.githubusercontent.com/304044/122415971-0372e100-cf91-11eb-8c51-00b0e55de301.mp4Crash log
``` java.lang.IllegalArgumentException: Illegal start(60) or end(80) position for totalSize(62) at org.wordpress.android.fluxc.model.list.datasource.InternalPagedListDataSource.getItemIds(InternalPagedListDataSource.kt:61) at org.wordpress.android.fluxc.model.list.datasource.InternalPagedListDataSource.getItemsInRange(InternalPagedListDataSource.kt:51) at org.wordpress.android.fluxc.model.list.PagedListPositionalDataSource.loadRangeInternal(PagedListFactory.kt:58) at org.wordpress.android.fluxc.model.list.PagedListPositionalDataSource.loadRange(PagedListFactory.kt:49) at androidx.paging.PositionalDataSource.loadRange(PositionalDataSource.kt:430) at androidx.paging.PositionalDataSource.load$paging_common(PositionalDataSource.kt:348) at androidx.paging.LegacyPagingSource$load$2.invokeSuspend(LegacyPagingSource.kt:116) at androidx.paging.LegacyPagingSource$load$2.invoke(Unknown Source:10) at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:91) at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:165) at kotlinx.coroutines.BuildersKt.withContext(Unknown Source:1) at androidx.paging.LegacyPagingSource.load(LegacyPagingSource.kt:115) at androidx.paging.LegacyPageFetcher$scheduleLoad$1.invokeSuspend(LegacyPageFetcher.kt:53) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:920) ```This seems to be new to
17.6
according to SentrySteps to reproduce the behavior
By scrolling
By clearing the cache (not reproduced consistently)
Tested on Pixel 2 XL / 5, Android 11 / 12 beta 2, WPAndroid 17.6-rc-1