[ALOY-1328] Refactor data-binding to be incremental rather then reset
| GitHub Issue | n/a |
|---|---|
| Type | Story |
| Priority | None |
| Status | Open |
| Resolution | Unresolved |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | Models, XML |
| Labels | n/a |
| Reporter | Fokke Zandbergen |
| Assignee | Feon Sua Xin Miao |
| Created | 2015-11-12T08:52:57.000+0000 |
| Updated | 2015-11-20T20:00:01.000+0000 |
Description
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