You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! Thanks for the code sharing!
I have found you are not showing data fetched from local DB while the remote request is running:
moviesListViewModel.getMoviesLiveData().observe(this, resource -> {
if(resource.isLoading()) {
//updateMoviesList(resource.data); - SHOULD BE HERE!
} else if(!resource.data.isEmpty()) {
updateMoviesList(resource.data);
} else handleErrorResponse();
});
What is the reason for such approach?
P.S.: Another point is you should not check resource.data.isEmpty() before updateMoviesList because of all movies can be removed from a remote server, but you will still have them on a local device screen
The text was updated successfully, but these errors were encountered:
Hi! Thanks for the code sharing!
I have found you are not showing data fetched from local DB while the remote request is running:
What is the reason for such approach?
P.S.: Another point is you should not check
resource.data.isEmpty()
beforeupdateMoviesList
because of all movies can be removed from a remote server, but you will still have them on a local device screenThe text was updated successfully, but these errors were encountered: