[ALOY-1328] Refactor data-binding to be incremental rather then reset

GitHub Issuen/a
Affected Version/sn/a
Fix Version/sn/a
ComponentsModels, XML
ReporterFokke Zandbergen
AssigneeFeon Sua Xin Miao


We should think about how we can refactor data-binding to be more efficient. *Current situation* * We add a single event listener to the collections fetch destroy change add remove reset events. * The event listener always regenerates the views for all models, remove the existing children and adds the newly generated views (for ListViews and some others it just overwrites). *Problems* Even if just a single attribute of a single model is changed: * It uses a lot of memory. * It crosses the bridge a lot of times. * It takes a long time as collections become bigger and the bound views more complex. * Resetting all children causes flickering and scroll position is lost. *Desired situation* * For the add event, only child views for the added model(s) are generated and added to the parent. * For the change event, child views for just the changed model(s) are regenerated and the old ones replaced under the parent. ** Yes, it would be even better if we could just change the child view of the model *attribute* that was changed, but I don't think the complexity of the logic is worth going that far. * For the destroy and remove events, only child views for the destroyed model(s) are removed from the parent.


No comments

JSON Source