Shopify / FunctionalTableData

Declarative UITableViewDataSource implementation
MIT License
365 stars 30 forks source link

Fix bug where the Section Headers are not updated correctly #174

Closed mmroz closed 5 years ago

mmroz commented 5 years ago

Fixed equality checking for the TableSectionHeaderFooter so that it changes appropriately.

scottybobandy commented 5 years ago

Some context on why this is here:

We wanted an isEqual(_ other: TableHeaderFooterConfigType?) -> Bool so we could compare two header/footers and re-render a TableSection if there were any state changes. If we added this as a requirement to the TableHeaderFooterConfigType protocol, without providing a default implementation, it would become a breaking change for any objects conforming to TableHeaderFooterConfigType that didn't implement it. The default implementation only exists to prevent that (it should always just evaluate too true, if the headers are of the same type, so that we maintain the previous behaviour of not updating at all).

This fix implements the functionality for the out-of-the-box TableSectionHeaderFooter that we provide in ftd, but it removes the default conformance for any other custom implementors of TableHeaderFooterConfigType; which is a breaking change.