From 129d646f8fcdf044a2126d8dbeb3d16409a8ee99 Mon Sep 17 00:00:00 2001 From: Maxime Ollivier Date: Tue, 8 Sep 2020 09:06:16 -0700 Subject: [PATCH] upcoming release will be 5.0.0 Summary: Starting this stack by bumping the next release version, because we're about to make breaking changes (plus there's already breaking changes since the last release) # Project overview ## Stability improvements * `[IGListAdapter setDataSource]` isn't safe * We're changing the underlying data without telling the `UICollectionView`. * Fix: Lets invalidate the `UICollectionView` data by changing its dataSource. More details in the diffs. * `[IGListAdapter setCollectionView]` isn't safe * This is synchronous, but we might have pending or on-going updates. The `UICollectionView` might get synced before the pending update actually start executing, so the diff results will be off. * Fix: Lets wrap updates in a transaction that can be cancelled. * Returning a nil `IGListSectionController` from `IGListAdapterDataSource` could crash * The `IGListAdapterUpdater` will still perform the diffing assuming that all the objects will have a section, which isn't the case. * Fix: Lets generate the `IGListSectionController` before the diffing. * Multiple item update blocks can conflict and crash * Because section-controllers can directly insert/delete/move `NSIndexPath`, we can run into conflicts when merging multiple batch updates together. * Fix: Working on automatic conflict resolution. * Item reloads aren't safe * Lets say you have a section with items ["a", "b"] and need to update to items ["b-reloaded"]. You reload "b" (index 1) and delete "a" (index 0) in the same batch update block (or in separate blocks within the same overall update). This gets converted into 3 changes: delete 0, insert 1, delete 1 ... but we only have 1 item, so index 1 doesn't make sense anymore! This is because we convert reloads to insert/deletes without taking into account that inserts are relative the list after the update. * Fix: Same as above, we need to convert the index to match the list after the update. * Other * Lets ask for the `fromObject` just before diffing, instead of asking when scheduling the update. * If the `UICollectionView` section count doesn't match `fromObject`, lets fallback to a reload. ## Performance improvements * Re-test background diffing * `IGListExperimentBackgroundDiffing` and coalescing updates wasn't safe because of the issues mentioned above. The longer we wait, the more likely we'll end up in a race condition. Lets try re-testing with the stability improvements. * Less array resizing and set hashing * We can skip some hashing by using an `NSArray` instead of a `NSSet` in `updateObjects`. The adapter or updater should have dealt with uniqueness already. * Avoid calling `[UICollectionView performBatchUpdate ...]` * If there's no update, lets try skipping `performBatchUpdate`. * Background work * This is a larger project that will need to be borken out, but these improvements are required to make background work safe. * Avoid double cell creation * Still investigating why this is happening ## Other * Transactions * `IGListAdapterUpdater` is the workhorse of `IGListKit` and has become a bit hard to follow over the years. We want to break it apart into simpler, more manageable parts. * Avoid blocks * There's a lot of blocks flying around, making crash logs hard to read. Lets try to use methods/functions where possible. Reviewed By: patters Differential Revision: D23429237 fbshipit-source-id: ac200f139df05fefea2a83e1b942d58638ff9e15 --- CHANGELOG.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 869de515..4f2eaa01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,18 +3,21 @@ The changelog for `IGListKit`. Also see the [releases](https://github.com/instagram/IGListKit/releases) on GitHub. -4.1.0 (upcoming release) +5.0.0 (upcoming release) ----- +### Breaking Changes + + +### Enhancements + - Introduce `IGListSwiftKit`, with Swift refinements for `dequeueReusableCellOfClass` methods. [Koen Punt](https://github.com/koenpunt) [(#1388)](https://github.com/Instagram/IGListKit/pull/1388). - Added `APPLICATION_EXTENSION_API_ONLY` support for `IGListDiffKit` [Peter Meyers](https://github.com/pm-dev) [(#1422)](https://github.com/Instagram/IGListKit/pull/1422) -### Enhancements - - Improved performance by deferring requesting objects from the `IGListAdapterDataSource` until just before diffing is executed. If n updates are coalesced into one, this results in just a single request for objects from the data source. Shipped with experiment `IGListExperimentDeferredToObjectCreation` from Ryan Nystrom. [Maxime Ollivier](https://github.com/maxolls) (tbd) -- Improved performance by using `reloadData` when there are too many diffing updates. Shipped with experiment `IGListExperimentReloadDataFallback` from Ryan Nystrom. [Maxime Ollivier](https://github.com/maxolls) (tbd) +- Improved performance by using `reloadData` when there are too many diffing updates. Shipped with experiment `IGListExperimentReloadDataFallback` from Ryan Nystrom. [Maxime Ollivier](https://github.com/maxolls) (tbd) ### Fixes