These are chat archives for ReactiveX/RxJava

19th
Mar 2016
Dmitriy Zaitsev
@DmitriyZaitsev
Mar 19 2016 22:45

Hi guys!
I’ve faced one strange problem.

private static Observable<List<Repository>> repositories(GitHubApi api, String user) {
  return api.getRepositories(new UserQuery(user), Sort.UPDATED, Order.ASC)
      .map(Result::response)
      .map(Response::body)
      .map(RepositoriesResponse::getItems);
  }
@Override public Observable<List<RepositoryDto>> getUsersRepositories(String user) {
  return repositories(mApi, user)
      .doOnNext(DataRepositoryImpl::saveToCache) // WTF???
      .flatMap(Observable::from)
      .map(DomainDataMapper::toRepositoryDto)
      .toList();
  }

This code works well. I can obtain list of repositories from github and show them on UI, but I’m wondering why method saveToCache is not invoked.

Observable2 does emit one item, but somehow action from doOnNext does nothing