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

Bug while reordering a single section item to the last spot and back #1288

Closed
ofirgluzman opened this issue Dec 18, 2018 · 0 comments
Closed

Comments

@ofirgluzman
Copy link
Contributor

ofirgluzman commented Dec 18, 2018

General information

  • IGListKit version: master branch
  • iOS version(s): 10.0-12.0
  • CocoaPods/Carthage version:
  • Xcode version: 10.1
  • Devices/Simulators affected: All
  • Reproducible in the demo project? (Yes/No): Yes
  • Related issues:

Hi,

I've detected the following bug in the interactive reordering mechanism:
On UICollectionViewLayout+InteractiveReordering, interactive transaction between two single-item sections and destination of the last spot is treated uniquely as follow:

// if we're moving an item to the last spot, our index would exceed the number of sections available
// so we have to special case this scenario. iOS doesnt allow an item move to "create" a new section
adapter.isLastInteractiveMoveToLastSectionIndex = YES;

The problem is, that this logic is done in the method updatedTargetForInteractivelyMovingItem:toIndexPath:adapter: which is called repeatedly during the interactive dragging. Therefore, I can start dragging a single section item to the last spot in the collection view, and by that setting (while still dragging) adapter.isLastInteractiveMoveToLastSectionIndex to YES and then drag the item back (without ever lifting up the finger) to a non-last spot while adapter.isLastInteractiveMoveToLastSectionIndex is still YES. If I will end the dragging then, the adapter will update the items as if the item was dragged to the last spot (because adapter.isLastInteractiveMoveToLastSectionIndex is still set to YES).

bug_reproduced

barakwei pushed a commit to Lightricks/IGListKit that referenced this issue Feb 11, 2019
…ordering. (Instagram#1289)

Summary:
Issue fixed: Instagram#1288

- [x] All tests pass. Demo project builds and runs.
- [x] I added tests, an experiment, or detailed why my change isn't tested.
- [x] I added an entry to the `CHANGELOG.md` for any breaking changes, enhancements, or bug fixes.
- [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/.github/CONTRIBUTING.md)
Pull Request resolved: Instagram#1289

Reviewed By: timonus

Differential Revision: D13590406

Pulled By: rnystrom

fbshipit-source-id: 0814b0c2383a185da747176bad57dfb15c7e883f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant