stakwork / sphinx-kotlin-ui

MIT License
3 stars 6 forks source link

Bug: Crash when sending message #18

Closed kngako closed 2 years ago

kngako commented 2 years ago

Paging API gets an index out of bounds.

Exception in thread "AWT-EventQueue-0" java.lang.IndexOutOfBoundsException
    at com.squareup.sqldelight.android.paging3.OffsetQueryPagingSource$load$2$1.invoke(OffsetQueryPagingSource.kt:40)
    at com.squareup.sqldelight.android.paging3.OffsetQueryPagingSource$load$2$1.invoke(OffsetQueryPagingSource.kt:38)
    at com.squareup.sqldelight.TransacterImpl.transactionWithWrapper(Transacter.kt:235)
    at com.squareup.sqldelight.TransacterImpl.transactionWithResult(Transacter.kt:221)
    at com.squareup.sqldelight.Transacter$DefaultImpls.transactionWithResult$default(Transacter.kt:61)
    at com.squareup.sqldelight.android.paging3.OffsetQueryPagingSource$load$2.invokeSuspend(OffsetQueryPagingSource.kt:38)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
kngako commented 2 years ago

Bug and crash is related to the sqldelight paging implemenation. Fix is planned for version 2.0.0 of the library/extension. https://github.com/cashapp/sqldelight/issues/2591

In the meantime we could remove the use of paging and use the previous implemenation of loading 1000 messages in a chat.