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

RxTableViewSectionedAnimatedDataSource dataSource sectionModels are always same with newSections #401

Open
arpitdsoni opened this issue Jun 1, 2021 · 2 comments

Comments

@arpitdsoni
Copy link

arpitdsoni commented Jun 1, 2021

I have been debugging an issue where cell viewModel gets updated but cell reloading doesn't happen until user manually scrolls cell off screen.

I have verified that IdentifiableType and Equatable are implemented correctly and cellModel properties do get updated, however oldSections and newSections in tableView(_ tableView: UITableView, observedEvent: Event<Element>) are always same, because of this lhs and rhs are always same for all items. I don't understand how dataSource.sectionModels are updated before even diff happens

Observable.combineLatest inside getDashboardItemsAsObservable() to create AnimatableSectionModel(model: "some", items: cellViewModels)

viewModel.getDashboardItemsAsObservable()
  .asDriver(onErrorJustReturn: [])
  .debug()
  .do(onNext: { [weak self] (sectionModel) in
     //
  })
  .drive(tableView.rx.items(dataSource: viewModel.dataSource))
  .disposed(by: disposeBag)

Any help is appreciated!

@arpitdsoni arpitdsoni changed the title RxTableViewSectionedAnimatedDataSource cellForRowAt isn't called until cell goes offscreen RxTableViewSectionedAnimatedDataSource dataSource sectionModels are always same with newSections Jun 4, 2021
@caosuyang
Copy link

i meet the same problem,how did you resolve it?

@caosuyang
Copy link

I probably know the reason. It may be that after the viewmodel is updated, it is still the previous viewmodel without creating a new viewmodel, resulting in Equatable being always consistent.

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

2 participants