Hello everyone! I use SQLDelight and Paging librar...
# squarelibraries
в
Hello everyone! I use SQLDelight and Paging libraries by CashApp. I wrote a code for pagination according to CashApp's documentations. Everything works good, but when data is updated in database, data in list with pagination on UI isn't updated. Functions 'getRefreshKey' and 'load' are also not recalled
I subscribed to the data change in database. I manually refresh data after changing data in database. It works for me
k
What's inserting data into your database? Is it by chance a different process, like WorkManager? SQLDelight will only notify other query watchers that data has changed within the same process, I beleive.
в
@kevin.cianfarini Thank you for your response! I'd like to describe my case a little bit more to help understand my problem better. I think that I insert data into database only from main process because I have only 1 process per application and don't use WorkManagers at current moment. By the way, my project is OpenSource project so I could share some code for updating and reading data from DB which I use in my application at this case. Probably, someone can find some mistakes in my approach for getting notifications about updates in DB. Data reading - click. Data adding - click.
v
I just checkout out your project and it doesn't seem like you're using the SQLDelight Paging extension. Would that help at all? The extension uses Multiplatform Paging under the hood, even though it's not clear from the documentation
в
@veyndan Sure, I use Paging library by Cash app (
app.cash.paging:paging-common
), but I don't use SQLDelight Paging extension. I've just checked SQLDelight Paging extension. Unfortunately, SQLDelight Paging is available only from
2.0.0-alpha05
version of SQLDelight, isn't it?
v
Yep, that sounds right. If you're not comfortable depending on an alpha release, you should be able to copy-paste the extension source code while we wait for SQLDelight
2.0.0
to be released. There aren't that many files in the extension, and it doesn't depend on any internals of SQLDelight (just the public facing APIs).