DiffableDataSources icon indicating copy to clipboard operation
DiffableDataSources copied to clipboard

Applying a snapshot near the bottom of a table view jumps its scroll position

Open rafaelnobrekz opened this issue 2 years ago • 0 comments

Checklist

  • [x] This is not a Apple's bug.
  • [x] Reviewed the README and documents.
  • [x] Searched existing issues for ensure not duplicated.

Expected Behavior

On tableView didSelect delegate callback, I toggle the snapshot's Item isSelected property and apply a new snapshot with this data changed (otherwise selection would be lost when reusing cells, as the selection is set in my cell provider from the item) When using the native UITableViewDiffableDataSource, the table view remains at the same content offset no matter where I apply the snapshot from.

Current Behavior

When using DiffableDataSource's TableViewDiffableDataSource, and the tableview's bottommost rows are visible, the scrolling position is offset after applying a snapshot

Reproducible Demo Project

https://github.com/rafaelnobrekz/DiffableDataSourceOffsetBug

Environments

  • version: 0.5

  • Swift version: 5.5

  • iOS version: 11-16

  • Xcode version: 14.2

  • Devices/Simulators:

  • CocoaPods/Carthage version:

rafaelnobrekz avatar Apr 11 '23 23:04 rafaelnobrekz