Skip to content

Commit

Permalink
fixed IGListAdapterUpdater completion block animation transaction
Browse files Browse the repository at this point in the history
Summary:
* Issue: UIView animation blocks created within IGListAdapterUpdater's completion block work sporadically. Example: Direct message animation:

https://pxl.cl/8sTk

* Cause: completion block called within CATransaction begin/commit
* Fix: commit CATransaction before calling completion block

Reviewed By: rnystrom

Differential Revision: D5592948

fbshipit-source-id: e7b20877b688a6a221a87b152ead830ccb34f12a
  • Loading branch information
Maxime Ollivier authored and facebook-github-bot committed Aug 10, 2017
1 parent 9e31227 commit 6f946b2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The changelog for `IGListKit`. Also see the [releases](https://github.com/instag

- Prevent a crash when update queued immediately after item batch update. [Ryan Nystrom](https://github.com/rnystrom) (tbd)
- Return correct `-[IGListAdapter visibleSectionControllers]` when section has no items, but has supplementary views. [Mani Ghasemlou](https://github.com/manicakes) [(#643)](https://github.com/Instagram/IGListKit/issues/643)
- Call `[CATransaction commit]` before calling completion block in IGListAdapterUpdater to prevent animation issues. [Maxime Ollivier](https://github.com/maxoll) (tbd)

### Enhancements

Expand Down
2 changes: 1 addition & 1 deletion Source/IGListAdapterUpdater.m
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ - (void)performBatchUpdatesWithCollectionView:(UICollectionView *)collectionView
[collectionView performBatchUpdates:^{
batchUpdatesBlock(result);
} completion:^(BOOL finished) {
batchUpdatesCompletionBlock(finished);
[CATransaction commit];
batchUpdatesCompletionBlock(finished);
}];
}
} @catch (NSException *exception) {
Expand Down

2 comments on commit 6f946b2

@weyert
Copy link
Contributor

@weyert weyert commented on 6f946b2 Aug 10, 2017

Choose a reason for hiding this comment

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

What issue does this fix? The video is not accessible.

@rnystrom
Copy link
Contributor

Choose a reason for hiding this comment

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

It's an internal bug we discovered. Basically trying to animate anything inside the completion block would fail because animations are still disabled.

Please sign in to comment.