We may hold the cache of UI identified by Model, may be with Model key for easy lookup. Then the IComponent.View may lookup for the cached UI if the Model did not change.
Naive question, what if we just added new UI to container, can we just reuse the rest of the container to minimize allocations? UI tree is immutable. What if we pass previous UI to View?
UI View(UI old, Model model) { .. }
May be it defeats the whole purpose of the model projection to view. Then the virtual UI Diff + Caching should be smart enough to do minimum allocations and do a fast real UI patching.
We may hold the cache of UI identified by Model, may be with Model key for easy lookup. Then the
IComponent.View
may lookup for the cached UI if the Model did not change.Naive question, what if we just added new UI to container, can we just reuse the rest of the container to minimize allocations? UI tree is immutable. What if we pass previous UI to View?
May be it defeats the whole purpose of the model projection to view. Then the virtual UI Diff + Caching should be smart enough to do minimum allocations and do a fast real UI patching.