Question:How to solve the problem of local no data in first time?
Hello,I like this repo very much.Have a question through.In source code,we fist load from db.But the local have not data when we install app in first time.so,the Flowable can not perform #onNext and #doAfterNext,then the app will toast "retry".How to solve this problem?Thanks.
Hie! Thank you for taking time out and going through the code.
On first load, the local.getPostsWithUsers() will send back an empty result and not an error. The call will then be made to refreshPosts() to load data from the server. We never see the "Retry" toast.
Thanks for your reply.Let's give an example of ListReposity.kt.In fetchPosts method.we called first local.getPostsWithUsers() and then called refreshPosts() when we should fetch.But in first time,we have not data in local.so,Room will send back an empty,Does not call the doAfterNext()(I just tried to query the nonexistent data in Room, which is true).Can you help me solve this problem?Thanks.
Room will send back an empty,Does not call the doAfterNext()
This is not true in our example. It does call doAfterNext() with an empty list.
@karntrehan Hie,borther!Thanks for a lot.I understand your means.The Room will return empty List other than null when the return type was List<T>,so doAfterNext() is bound to be executed.
Yes. Correct. Please close the issue if your doubt has been solved. :)
it gives me this error-
Caused by: android.database.sqlite.SQLiteConstraintException: NOT NULL constraint failed: Post.postTitle