• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Instagram / IGListKit / 10530664450
96%
master: 100%

Build:
Build:
LAST BUILD BRANCH: main
DEFAULT BRANCH: master
Ran 23 Aug 2024 06:42PM UTC
Jobs 1
Files 52
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

23 Aug 2024 06:32PM UTC coverage: 97.895% (+0.01%) from 97.883%
10530664450

push

github

facebook-github-bot
fix crash when reloading the same cell index multiple times

Summary:
## Context
Merging multiple batch updates of the same section is inherently unsafe, because each block can mutate the underlaying list and lead to insert/deletes that operate on different before/after lists. The long term fix is to get rid of item level batch updates (insert/delete calls) and use diffing like for sections, but that's a much larger project.

Right now, we have a crash spiking because we're reloading the same cell multiple times. Each time `IGListDiff(...)` returns a pair of insert/delete for the same index (lets say 0). Once these updates are merge together, they look like this:
```
Item inserts = 0, 0
Item deletes = 0, 0
```
We dedupe deletes in `IGListBatchUpdateData`, but don't do anything for inserts, so it looks liket this:

```
Item inserts = 0, 0
Item deletes = 0
```

So we create an insert/delete unbalance and can crash. Tbh, not sure how this hasn't been a bigger issue in the past.

D21822502 tried to remove all duplicate inserts, but that caused other types of crashes, because multiple inserts are allowed.

## This diff

* Lets keep the net insert/delete count the same by keeping track of the number of deletes we remove and apply the same to inserts.
* Add some tests
* Add an experiment flag to kill this if needed to be safe. IG only: Note that I'm making the default true because the crash is happening pretty at start-up.

## Follow up

Over time, the batch update clean up logic was slowly added to multiple place (IGListBatchUpdateData, IGListAdapterUpdaterHelpers, IGListIndexPathResult), which is making it hard to follow. A first step would be to move it  in 1 or 2 places and avoid redundant logic (like getting unique deletes). However, the real fix is getting rid of batch updates all together.

Differential Revision: D61719884

fbshipit-source-id: eda7c264c

32 of 32 new or added lines in 3 files covered. (100.0%)

4186 of 4276 relevant lines covered (97.9%)

720.5 hits per line

Jobs
ID Job ID Ran Files Coverage
1 iOS - 10530664450.1 23 Aug 2024 06:42PM UTC 0
97.88
GitHub Action Run
Source Files on build 10530664450
Detailed source file information is not available for this build.
  • Back to Repo
  • Github Actions Build #10530664450
  • 0c257795 on github
  • Prev Build on main (#10497962276)
  • Next Build on main (#10582797973)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc