Checklist
Expected Behavior
Table reloads
Current Behavior
Table reloading failed with exception:
Thread 1: "attempt to insert row 0 into section 1, but there are only 0 rows in section 1 after the update"
Steps to Reproduce
Code example:
class Item { ... }
class Group {
var isExpanded = true
var items: [Item] = ...
func visibleItems() -> [Item] { isExpanded ? self.items : [] }
...
}
var groups: [Group] = {
let group = Group()
group.items = Item()
return [group]
}()
Where groups represent sections and items represent rows. Just expand-collapse a section (isExpanded changed), calc the diff and try to reload the table with these data using any method in this library.
Detailed Description (Include Screenshots)
The problem is in your reload method which attempts to reload data step-by-step. In my case it means on expand it attempts to add one Item and insert it into the table immediately ignoring isExpanded value which should be updated in the next run loop.
Reproducible Demo Project
I don't have but it seems the task is trivial to reproduce.
Environments
Doesn't matter because there is an error inside this library algo.
Checklist
Expected Behavior
Table reloads
Current Behavior
Table reloading failed with exception:
Thread 1: "attempt to insert row 0 into section 1, but there are only 0 rows in section 1 after the update"Steps to Reproduce
Code example:
Where
groupsrepresent sections anditemsrepresent rows. Just expand-collapse a section (isExpanded changed), calc the diff and try to reload the table with these data using any method in this library.Detailed Description (Include Screenshots)
The problem is in your reload method which attempts to reload data step-by-step. In my case it means on expand it attempts to add one
Itemand insert it into the table immediately ignoringisExpandedvalue which should be updated in the next run loop.Reproducible Demo Project
I don't have but it seems the task is trivial to reproduce.
Environments
Doesn't matter because there is an error inside this library algo.