ios-app
ios-app copied to clipboard
[FEATURE REQUEST] Prevent reloading whole File List for every ETAG Change
Problem
Currently the file list gets a reload for every ETAG change. This means when the client shows the root folder and an item in a subdirectory was changed, the root file list will be reloaded. On a large account the file list will be reloaded every seconds on the first sync which may leads in other side effects:
- keyboard selection gets los (when trying to restore the last selection the UI will flicker)
Expected Result
Not the whole table view should be updated on changes, only affected cells should be updated. Restore the keyboard selection after an file list update.
Testing
Test if the performance is good with a large file list.
Pseudo Code
if oldItems.count == newItems.count {
// Same item count -> compare
var reloadIndexes : …
for i… {
if oldItems[i].localID != newItems[i].localID {
// Different item -> reload cell
reloadIndexes += i
} else if oldItems[i].displaysDifferent(than: newItems[i].localID) {
// Displayed content changed -> reload cell
reloadIndexes += i
} else {
// Displayed content didn't change, but item info did
if let cell = tableView.cellForRow(…) as? QueryTableViewCell {
cell.item = newItems[i]
}
}
}
items = newItems
if reloadIndexes.count > 0 {
tableView.reloadRowsAtIndexes(reloadIndexes)
}
} else {
// Different item count -> reload
reloadTable()
}