androidbroadcast / Jetpack-Paging-3-Sample

33 stars 5 forks source link

Error on launch: Attempt to collect twice from pageEventFlow, which is an illegal operation. Did you forget to call Flow<PagingData<*>>.cachedIn(coroutineScope)? #1

Open shipsywor opened 3 years ago

shipsywor commented 3 years ago
2021-06-02 00:25:29.561 19186-19186/dev.androidbroadcast.sample.paging3 E/.sample.paging: Invalid ID 0x00000000.
2021-06-02 00:25:29.637 19186-19186/dev.androidbroadcast.sample.paging3 E/AndroidRuntime: FATAL EXCEPTION: main
    Process: dev.androidbroadcast.sample.paging3, PID: 19186
    java.lang.IllegalStateException: Attempt to collect twice from pageEventFlow, which is an illegal operation. Did you forget to call Flow<PagingData<*>>.cachedIn(coroutineScope)?
        at androidx.paging.PageFetcherSnapshot$pageEventFlow$1.invokeSuspend(PageFetcherSnapshot.kt:81)
fayaz07 commented 2 years ago

@shipsywor did you get a fix for this?

saintjab commented 1 year ago

Need to cache the result after the call passing the scope you want it cached.