[x] This is not an Apple's bug. It works on the original implementation.
[x] Reviewed the README and documents.
[x] Searched existing issues for ensure not duplicated.
Expected Behavior
Applying two sets of trivial data to a collectionview, I expect the UI to match it in all cases - or at least understand which exceptional cases I should guard against and work them around as needed.
Current Behavior
Filtering a simple model array to a particular state makes the collection view fail to display them correctly, whereas the apple implementation does it.
Steps to Reproduce
Create a snapshot from an array of Hashable models that combines the state from an array of model objects (simple id/title strings) and a isFavorite boolean value)
Given a state0 (full list), filter it into state1 (filtered by some criteria)
Filter it again into state1 (different, non-exclusive criteria)
Toggle applying state1 and state2 to the table view. Going from state1 -> state2 yield different changesets every time you run it, most of the time resulting in wrong state
The collection view shows more items after snapshot from state2 being applied, than the actual array/snapshot has. The indexes get mixed up between what you tap and what is in the source array
Actually the bug can be fixed by using the diffable item provided by the data source provider handler instead of looking up the source array from the index 🤦♂️
Checklist
Expected Behavior
Applying two sets of trivial data to a collectionview, I expect the UI to match it in all cases - or at least understand which exceptional cases I should guard against and work them around as needed.
Current Behavior
Filtering a simple model array to a particular state makes the collection view fail to display them correctly, whereas the apple implementation does it.
Steps to Reproduce
The collection view shows more items after snapshot from state2 being applied, than the actual array/snapshot has. The indexes get mixed up between what you tap and what is in the source array
Detailed Description (Include Screenshots)
I don't understand the cause exactly.
Reproducible Demo Project
https://github.com/rafaelnobrekz/DiffableBugRepro
Environments
version: 0.5.0 (DifferenceKit 1.2.0)
Swift version: 5.7
iOS version: iOS 16
Xcode version: Xcode 14
Devices/Simulators: iPhone 14 Pro Simulator (iOS 16), iPhone 12 Pro (iOS 16), iPhone 7 Plus (iOS13.7)
CocoaPods/Carthage version: n/a (SPM)