Skip to content

The latest version 8.0.1 crashes the app with IllegalStateException (whereas 8.0.0 works completely fine) #2037

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
vedprakashwagh opened this issue May 28, 2022 · 9 comments

Comments

@vedprakashwagh
Copy link

vedprakashwagh commented May 28, 2022

Environment

  • Android device: Android Emulator
  • Android OS version: Android 12
  • Google Play Services version: -
  • Firebase/Play Services SDK version: 28.4.2 (Firebase BOM)
  • FirebaseUI version: 8.0.1

Problem:

Steps to reproduce:

Scrolling through FirestorePagingAdapter will crash the app after first or second fetch.

Observed Results:

App crashes with following error.

java.lang.IllegalStateException: The same value, PageKey{StartAfter=KEY_ID_HERE, EndBefore=null}, was passed as the nextKey in two
     sequential Pages loaded from a PagingSource. Re-using load keys in
     PagingSource is often an error, and must be explicitly enabled by
     overriding PagingSource.keyReuseSupported.
        at androidx.paging.PageFetcherSnapshot.doLoad(PageFetcherSnapshot.kt:419)
        at androidx.paging.PageFetcherSnapshot.access$doLoad(PageFetcherSnapshot.kt:54)
        at androidx.paging.PageFetcherSnapshot$doLoad$1.invokeSuspend(Unknown Source:15)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loopOnce(Looper.java:201)
        at android.os.Looper.loop(Looper.java:288)
        at android.app.ActivityThread.main(ActivityThread.java:7839)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)

Expected Results:

Load the next set of data

Relevant Code:

It works perfectly fine with FirebaseUI version 8.0.0, but upgrading to 8.0.1 crashes the app with following error.

@maratkarelov
Copy link

the same error occured

@LastSocialDroid2
Copy link

@shrutip90
Copy link

Internal bug filed at b/235862945

@thatfiredev
Copy link
Member

thatfiredev commented Jun 14, 2022

Thanks for filing this @vedprakashwagh ! I'll have a look at it.
( looks like a duplicate of #2000 )

Edit: this is not a duplicate because it refers to Firestore, while the other issue refers to the Realtime Database.

@thatfiredev thatfiredev self-assigned this Jun 14, 2022
@thatfiredev
Copy link
Member

thatfiredev commented Jun 14, 2022

@vedprakashwagh Can you please also share the full Query that you passed to your FirebaseRecyclerPagingAdapter?

@LastSocialDroid2
Copy link

LastSocialDroid2 commented Jun 14, 2022

@thatfiredev I'm getting the same error with this Query:

Query query = notebookRef.orderBy("timestampSort", Query.Direction.ASCENDING);

@vedprakashwagh
Copy link
Author

@thatfiredev Hey! Yes, here's the query.

query = Firebase.firestore.collection("collectionName")
.orderBy("keyOfTimestamp", Query.Direction.DESCENDING)

@dhoehl
Copy link

dhoehl commented Jul 10, 2022

After two days of debugging my code, I also figured that version 8.0.0 still works where 8.0.1 crashes on the first paging load (not initial). Query also is of the sort Firebase.firestore.collection("collectionName")
.orderBy("keyOfTimestamp", Query.Direction.DESCENDING)

@thatfiredev
Copy link
Member

This issue should be solved in version 8.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants