airbnb / airbnb/MagazineLayout
Alignment bug on simultaneous insertion and refresh
- Dominant language
- Swift
- Stars
- 3.4k
- Forks
- 222
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
An attempt to make two simultaneous changes in collection view causes UI glitches
**To Reproduce**
Add the next piece of code to the `performBatchUpdates`
```
let itemInfo1 = ItemInfo(
sizeMode: state.sizeMode,
text: "Test test test test test test",
color: state.color)
self?.dataSource.removeItem(atItemIndex: 3, inSectionAtIndex: 0)
self?.dataSource.insert(itemInfo1, atItemIndex: 3, inSectionAtIndex: 0)
self?.collectionView.reloadItems(at: [IndexPath(item: 3, section: 0)])
```
Run the project and insert an item
You will see the effect that is described in the video. Cells will start animation from the wrong position and finish it in the wrong place
**Expected behavior**
All the items will reorder and update according to their positions
**Screenshots**
https://www.dropbox.com/s/rzfa5g8qbiamlcm/Missalignmets.mov?dl=0

**Smartphone (please complete the following information):**
- Device/Simulator: iPhone 11/XR (Simulator)
- OS: iOS12/13
**Additional context**
You did a fantastic job.
Contributor guide
Assessment
This issue has not been assessed yet.