@@ -546,6 +546,7 @@ final class StateController<Layout: ChatLayoutRepresentation> {
546
546
var insertedSectionsIndexesArray = [ ( Int , SectionModel < Layout > ? ) ] ( )
547
547
548
548
var reloadedItemsIndexesArray = [ IndexPath] ( )
549
+ var reconfiguredItemsIndexesArray = [ IndexPath] ( )
549
550
var deletedItemsIndexesArray = [ IndexPath] ( )
550
551
var insertedItemsIndexesArray = [ ( IndexPath, ItemModel? ) ] ( )
551
552
@@ -562,9 +563,7 @@ final class StateController<Layout: ChatLayoutRepresentation> {
562
563
563
564
reloadedItemsIndexesArray. append ( indexPath)
564
565
case let . itemReconfigure( itemIndexPath: indexPath) :
565
- reconfiguredIndexes. insert ( indexPath)
566
-
567
- reloadedItemsIndexesArray. append ( indexPath)
566
+ reconfiguredItemsIndexesArray. append ( indexPath)
568
567
case let . sectionDelete( sectionIndex) :
569
568
deletedSectionsIndexes. insert ( sectionIndex)
570
569
@@ -796,6 +795,21 @@ final class StateController<Layout: ChatLayoutRepresentation> {
796
795
}
797
796
}
798
797
798
+ for indexPath in reconfiguredItemsIndexesArray {
799
+ guard var item = item ( for: indexPath. itemPath, kind: . cell, at: . beforeUpdate) ,
800
+ let indexPathAfterUpdate = afterUpdateModel. itemPath ( by: item. id, kind: . cell) ? . indexPath else {
801
+ assertionFailure ( " Item at index path ( \( indexPath. section) - \( indexPath. item) ) does not exist. " )
802
+ continue
803
+ }
804
+ reconfiguredIndexes. insert ( indexPathAfterUpdate)
805
+
806
+ let oldHeight = item. frame. height
807
+ let configuration = layoutRepresentation. configuration ( for: . cell, at: indexPathAfterUpdate)
808
+ applyConfiguration ( configuration, to: & item)
809
+ afterUpdateModel. replaceItem ( item, at: indexPathAfterUpdate)
810
+ visibleBoundsBeforeUpdate. offsettingBy ( dx: 0 , dy: item. frame. height - oldHeight)
811
+ }
812
+
799
813
var afterUpdateModelSections = afterUpdateModel. sections
800
814
afterUpdateModelSections. withUnsafeMutableBufferPointer { directlyMutableSections in
801
815
for index in 0 ..< directlyMutableSections. count {
0 commit comments