You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @malcommac
I've started to use TableDirector for rendering some parts of the content in my app and noticed really strange behavior - if you do an insertion into TableSection the whole section gets refreshed. Because this was not happening for CollectionDirector, I've started to look into your algorithm and it appeared that for TableSection the implementation of isContentEqual is different and I believe is incorrect - instead of just comparing identifiers the implementation also looks into the content itself which actually forces DifferenceKit based algorithm to reload the whole section instead of simply do the insertion:
TableSection
public func isContentEqual(to other: Differentiable) -> Bool {
guard let other = other as? TableSection,
elements.count == other.elements.count else {
return false
}
for item in elements.enumerated() {
if item.element.isContentEqual(to: other.elements[item.offset]) == false {
return false
}
}
return true
}
CollectionSection
public func isContentEqual(to other: Differentiable) -> Bool {
guard let other = other as? CollectionSection else {
return false
}
return self.identifier == other.identifier
}
I did some fast tests and when I've changed the implementation of isContentEqual to the same as for CollectionSection, everything started to work better. Unfortunately, as the method is marked as public and not open I am not able to resolve this issue without your help.
Could you please do this small change in order to fix the bug?
The text was updated successfully, but these errors were encountered:
Hi @malcommac
I've started to use
TableDirector
for rendering some parts of the content in my app and noticed really strange behavior - if you do an insertion intoTableSection
the whole section gets refreshed. Because this was not happening forCollectionDirector
, I've started to look into your algorithm and it appeared that forTableSection
the implementation ofisContentEqual
is different and I believe is incorrect - instead of just comparing identifiers the implementation also looks into the content itself which actually forces DifferenceKit based algorithm to reload the whole section instead of simply do the insertion:TableSection
CollectionSection
I did some fast tests and when I've changed the implementation of
isContentEqual
to the same as forCollectionSection
, everything started to work better. Unfortunately, as the method is marked aspublic
and notopen
I am not able to resolve this issue without your help.Could you please do this small change in order to fix the bug?
The text was updated successfully, but these errors were encountered: