onmyway133 / DeepDiff

🦀Amazingly incredible extraordinary lightning fast diffing in Swift
https://onmyway133.com/apps/
Other
2.05k stars 145 forks source link

Crash: attempt to delete item 20 from section 0 which only contains 20 items before the update #54

Open ageevvalentin opened 4 years ago

ageevvalentin commented 4 years ago

I gets crash: Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'attempt to delete item 20 from section 0 which only contains 20 items before the update'

My changes: First Changes insert(0), insert(1), insert(2), insert(3), insert(4), insert(5), insert(6), insert(7), insert(8), insert(9), insert(10), insert(11), insert(12), insert(13), insert(14), insert(15), insert(16), insert(17), insert(18), insert(19) Second Changes insert(0), insert(1), insert(2), insert(3), insert(4), insert(5), insert(6), insert(7), insert(8), insert(9), insert(10), insert(11), insert(12), insert(13), insert(14), insert(15), insert(16), insert(17), insert(18), insert(19), update(20(was 0)) Crash!

I think changes update(20) should be update(0). Maybe collection view sees the changed items before inserted

github-actions[bot] commented 4 years ago

Message that will be displayed on users' first issue

ageevvalentin commented 4 years ago

Yes, UICollectionViewUpdateItem has indexPathBeforeUpdate and indexPathAfterUpdate. To use it with batch updates, you must use the following paths: Insert - new index Remove - old index Change - old index

harielakanti commented 3 years ago

Yes, UICollectionViewUpdateItem has indexPathBeforeUpdate and indexPathAfterUpdate. To use it with batch updates, you must use the following paths: Insert - new index Remove - old index Change - old index

Please give some reply in detail?, with some code reference