Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop section moves when the section was deleted in IGListBatchUpdateData #430

Closed
rnystrom opened this issue Jan 18, 2017 · 0 comments
Closed
Assignees
Labels
Milestone

Comments

@rnystrom
Copy link
Contributor

⚠️ Blocked by #418 ⚠️

Whenever a batch update comes in with a delete and a move-from in the same section, we convert the move to a delete+insert. This is probably wrong b/c the data source count will likely change (b/c of the delete) but since we gather deletes in an NSIndexSet, only one delete will occur along w/ an insert from the move conversion.

https://github.com/Instagram/IGListKit/blob/master/Source/Common/IGListBatchUpdateData.mm#L92-L93

So pseudocode illustrating the problem:

let moves: Set<Move> = [Move(from: 0, to: 1)]
let deletes: IndexSet = IndexSet(index: 0)
let batch = IGListBatchUpdate(... moves: moves, deletes: deletes ...)
print(batch.moves) // empty
print(batch.deletes) // 0
print(batch.inserts) // 1

Instead, we should drop the move entirely so only the delete wins. That way the expected data source changes are reflected w/ the batch update.

In theory everything is working fine now b/c this situation wont exist in IGListDiff(...). However let's future-proof ourselves

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants