Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data fetched from local DB doesn't show while remote request are running. #3

Open
isabsent opened this issue Oct 17, 2019 · 0 comments

Comments

@isabsent
Copy link

isabsent commented Oct 17, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant