android / codelab-android-paging

Jetpack Paging codelab
Apache License 2.0
491 stars 260 forks source link

The pagingSourceFactory from DB can lead wrong data display #202

Open hoangtuan877 opened 2 years ago

hoangtuan877 commented 2 years ago

In case you search for a key word then re-type and search again with another word included in your result list. The LIKE query will bring that result to top of screen because it still in your DB. and it can show up in UI before new data come in.

// appending '%' so we can allow other characters to be before and after the query string val dbQuery = "%${query.replace(' ', '%')}%" val pagingSourceFactory = { database.reposDao().reposByName(dbQuery)}