NestedTypes icon indicating copy to clipboard operation
NestedTypes copied to clipboard

Collection must know its changes made during the last transaction

Open gaperton opened this issue 9 years ago • 1 comments

Model knows it, so why collection shouldn't?

collection.changed - array of changed models. collection.added - same for added models collection.removed - same for removed models.

This feature will allow complete inspection of the last transaction made on models tree, making it possible to generate changes feed. Which will open the way to implement live data sync with server, because last transaction tree becomes completely traversable.

gaperton avatar Feb 18 '16 17:02 gaperton

added and removed - that's easy. Problem is to track changed models... Easiest way of doing this is to maintain changed hash, which is filled in on model's change event. Easiest and slowest one.

For reset it's not a problem, though. For set, it probably won't add a lot of overhead, considering all other things which are being done during the deep change... In most cases there won't be any duplicates, so we may use array, instead of hash.

So, we go with arrays.

gaperton avatar Feb 18 '16 18:02 gaperton