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

Prevent a crash when inserting the same index twice #616

Closed
wants to merge 3 commits into from

Conversation

rnystrom
Copy link
Contributor

@rnystrom rnystrom commented Apr 3, 2017

Changes in this pull request

If you insert or delete into the same index twice and update your data source to reflect those changes, we will squash the insert/delete into a single update because we're using NSSet internally.

This becomes very apparent when multiple updates are coalesced.

Issue fixed: #483

Checklist

  • All tests pass. Demo project builds and runs.
  • I added tests, an experiment, or detailed why my change isn't tested.
  • I added an entry to the CHANGELOG.md for any breaking changes, enhancements, or bug fixes.

@rnystrom rnystrom added this to the 3.0.0 milestone Apr 3, 2017
@facebook-github-bot
Copy link
Contributor

@rnystrom updated the pull request - view changes

moveIndexPaths:(NSSet<IGListMoveIndexPath *> *)moveIndexPaths NS_DESIGNATED_INITIALIZER;
insertIndexPaths:(NSArray<NSIndexPath *> *)insertIndexPaths
deleteIndexPaths:(NSArray<NSIndexPath *> *)deleteIndexPaths
moveIndexPaths:(NSArray<IGListMoveIndexPath *> *)moveIndexPaths NS_DESIGNATED_INITIALIZER;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this class is public, right?

need a changelog for breaking changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh weird, it is. But, why? This isn't supposed to be used on macOS.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why's that? there's nothing iOS-specific about this class, right? isn't it also needed for diffing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed for diffing, its like a "give me all your updates and I'll squish them". You're right it doesn't have anything iOS specific tho.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷‍♂️

@facebook-github-bot
Copy link
Contributor

@rnystrom updated the pull request - view changes

@jessesquires
Copy link
Contributor

updated change log. going to import

@facebook-github-bot
Copy link
Contributor

@jessesquires has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@jessesquires
Copy link
Contributor

cancelled import. something is broken

@jessesquires
Copy link
Contributor

Going to re-open this

@jessesquires
Copy link
Contributor

re-opened at #634

@jessesquires jessesquires removed this from the 3.0.0 milestone Apr 10, 2017
facebook-github-bot pushed a commit that referenced this pull request Apr 11, 2017
Summary:
Original comment:

If you insert or delete into the same index twice **and** update your data source to reflect those changes, we will squash the insert/delete into a single update because we're using `NSSet` internally.

This becomes very apparent when multiple updates are coalesced.

Issue fixed: #483

- [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.
Closes #634

Differential Revision: D4860479

Pulled By: jessesquires

fbshipit-source-id: 3aa271d90fca21b11201f62cefa8d7fbcef6930f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants