Fix OutlineList.setItems not reconfiguring cells for ContentEquatable items#66
Merged
Merged
Conversation
4455dcb to
871edfb
Compare
Extract shared algorithms from ListDataSource and MixedListDataSource into free functions (computeItemsToReconfigure, flattenSectionSnapshot), introduce ListConfigurable protocol to eliminate convenience API duplication across SimpleList/GroupedList/OutlineList, and remove dead bridge methods superseded by the new protocol extension. - Add ListConfigurable protocol with ~15 default implementations from 4 requirements (collectionView, snapshot, itemIdentifier, indexPath) - Extract computeItemsToReconfigure into AutoReconfigure.swift - Extract flattenSectionSnapshot into AutoReconfigure.swift - Remove dead ListConfigurationBridge methods (selectItem, deselectItem, isSelected, scrollToItem, scrollToTop, scrollToBottom) - Add retain cycle guidance to configuration class doc comments - Document @objc UIScrollViewDelegate forwarding duplication - Add scrollToBottom pre-layout behavior note - Use collectionView directly for numberOfItems/numberOfSections
871edfb to
af3b3fc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
OutlineList.setItems(and any section snapshot apply path) not triggering cell reconfiguration when aCellViewModelconforms toContentEquatableand content changes but identity stays the sameRoot Cause
ListDataSourcehas two apply paths:apply(_ snapshot:)) — callsautoReconfigureto detect content changesapply(_ sectionSnapshot:to:)) — passed directly toCollectionViewDiffableDataSource, bypassingautoReconfigureentirelyOutlineList.setItemsuses path 2 (section snapshots for hierarchical data), soContentEquatablechecks never ran.Fix
In
ListDataSource.apply(_:to:animatingDifferences:), instead of forwarding the section snapshot directly toCollectionViewDiffableDataSource, build the full snapshot (same delete-old/append-new-visible-items logic) and route through the regularapplypath. This naturally picks upautoReconfiguresinceself.applycalls it before forwarding.Test Plan
autoReconfigureWorksWithSectionSnapshotApply— flat section snapshot with content changeautoReconfigureWithSectionSnapshotDetectsContentChanges— verifies identity matches but content differsautoReconfigureWithHierarchicalSectionSnapshot— parent-child hierarchy with child content changeFixes #65