airbnb / airbnb/MagazineLayout

Alignment bug on simultaneous insertion and refresh

Open
#71 0 comments 0 reactions 1 assignee Claimed by @bryankeller View on GitHub
bug
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
![Screenshot 2020-03-27 at 00 58 11](https://user-images.githubusercontent.com/20243258/77710488-0ec1a180-6fc6-11ea-9c1a-452642362483.png)
**Smartphone (please complete the following information):**
- Device/Simulator: iPhone 11/XR (Simulator)
- OS: iOS12/13

**Additional context**
You did a fantastic job.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.