From 039e77e3593251c8711497f76ab25857d641ecee Mon Sep 17 00:00:00 2001 From: Zhisheng Huang Date: Mon, 29 Oct 2018 18:32:21 -0700 Subject: [PATCH] Add diffResult as argument to pass to willCrashWithException: in IGListAdapterUpdaterDelegate Summary: This would help us understands what was the diff result from the algorithm and compare it with the `updates` to check what went wrong. Essentially, this would make our debugging easier going forward. Reviewed By: calimarkus Differential Revision: D12828892 fbshipit-source-id: 6dc52cdba1adb5a841760b51599e2df4c845c364 --- CHANGELOG.md | 2 ++ Source/IGListAdapterUpdater.m | 1 + Source/IGListAdapterUpdaterDelegate.h | 2 ++ 3 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 454a95e63..7b339c5b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ The changelog for `IGListKit`. Also see the [releases](https://github.com/instag - Renamed `[IGListAdapterUpdatingDelegate listAdapterUpdater:willPerformBatchUpdatesWithCollectionView:]` to `[IGListAdapterUpdatingDelegate listAdapterUpdater:willPerformBatchUpdatesWithCollectionView:fromObjects:toObjects:listIndexSetResult:]` to include more supporting info on updated objects. [Jeremy Cohen] (https://github.com/jeremycohen) (tbd) +- Renamed `[IGListAdapterUpdatingDelegatelistAdapterUpdater:collectionView:willCrashWithException:fromObjects:toObjects:updates:]` to `[ IGListAdapterUpdatingDelegatelistAdapterUpdater:collectionView:willCrashWithException:fromObjects:toObjects:diffResult:updates:]` to include diff result info. [Zhisheng Huang] (https://github.com/lorixx) (tbd) + ### Enhancements - Added `IGListCollectionScrollingTraits` for exposing `UICollectionView` scrolling traits to section controllers via `IGListCollectionContext`. [Adam Stern](https://github.com/adamastern) (tbd) diff --git a/Source/IGListAdapterUpdater.m b/Source/IGListAdapterUpdater.m index 31a207063..98edfe44f 100644 --- a/Source/IGListAdapterUpdater.m +++ b/Source/IGListAdapterUpdater.m @@ -255,6 +255,7 @@ - (void)performBatchUpdatesWithCollectionViewBlock:(IGListCollectionViewBlock)co willCrashWithException:exception fromObjects:fromObjects toObjects:toObjects + diffResult:result updates:(id)self.applyingUpdateData]; @throw exception; } diff --git a/Source/IGListAdapterUpdaterDelegate.h b/Source/IGListAdapterUpdaterDelegate.h index 1d8059d89..0200faf83 100644 --- a/Source/IGListAdapterUpdaterDelegate.h +++ b/Source/IGListAdapterUpdaterDelegate.h @@ -141,6 +141,7 @@ willPerformBatchUpdatesWithCollectionView:(UICollectionView *)collectionView @param exception The exception thrown by the collection view. @param fromObjects The items transitioned from in the diff, if any. @param toObjects The items transitioned to in the diff, if any. + @param diffResult The diff result that were computed from `fromObjects` and `toObjects`. @param updates The batch updates that were applied to the collection view. */ - (void)listAdapterUpdater:(IGListAdapterUpdater *)listAdapterUpdater @@ -148,6 +149,7 @@ willPerformBatchUpdatesWithCollectionView:(UICollectionView *)collectionView willCrashWithException:(NSException *)exception fromObjects:(nullable NSArray *)fromObjects toObjects:(nullable NSArray *)toObjects + diffResult:(IGListIndexSetResult *)diffResult updates:(IGListBatchUpdateData *)updates; @end