Support for minimal ViewModel churn #730
Unanswered
JakenVeina
asked this question in
Q&A
Replies: 1 comment
-
Also could use a |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have the following scenario, for building an
ObservableCollection<T>
of ViewModel objects:In particular, it's the "interactive" nature of each ViewModel that makes them relatively expensive to construct, due to the number of data streams and commands that need to be constructed. Plus, swapping out an entire ViewModel within the binding layer is much more expensive than just having a bound property publish a new change. As such, my goals are:
By my reckoning (which may well be wrong) this is not achievable with DynamicData, for the following reasons:
.Transform()
does not preserve sorting information upon a sorted stream, as it only supports streams ofIChangeSet<>
rather thanISortedChangeSet<>
Update
changes, but still preserveMove
changes.I was able to build a proof-of-concept to solve these two issues, and build the following stream/query that behaves exactly as I want.
Specifically, I implemented a
.Transform()
operator that acceptsISortedChangeSet<>
and emitsISortedChangeSet<>
, preserving all the sorting state info, as well as a.ReduceRedundantChanges()
operator that behaves similarly to.IgnoreSameReferenceUpdate()
except that it preservesUpdate
s where the value is the same, but the index has changed, and translates those intoMove
s instead of ignoring them.Is there a combination of operators that I'm not spotting that would achieve this?
If not, is there any interest in a PR that would add either of these extensions?
Beta Was this translation helpful? Give feedback.
All reactions