Skip reloading file browser items if items are unchanged

The comparison is somewhat shallow, but ideally all changes to the actual items (rather than adding or removing items) is done by updating the properties of the existing instance. The exception here is the SCM Status data source, but FSItem’s isEqual: method does compare scmStatus.
This commit is contained in:
Allan Odgaard
2015-07-23 13:13:09 +02:00
parent b8906248bd
commit 22acd31b25

View File

@@ -432,9 +432,8 @@ struct expansion_state_t
++state->requests;
[_dataSource reloadItem:item completionHandler:^(NSArray* children){
// The reason we continue even with no changes is that icon updates (SCM status) are not reflected by `hasChanges`
BOOL hasChanges = !item.children || ![item.children isEqualToArray:children];
if(!state->stop && ([_outlineView editedRow] == -1 || hasChanges))
if(!state->stop && hasChanges)
{
NSIndexSet* indexSet = [_outlineView selectedRowIndexes];
for(NSUInteger index = [indexSet firstIndex]; index != NSNotFound; index = [indexSet indexGreaterThanIndex:index])