Updownquark / ObServe

Powerful observable application utilities
MIT License
1 stars 2 forks source link

New Mapping Option #17

Closed Updownquark closed 4 years ago

Updownquark commented 4 years ago

XformOptions needs a new option, propagateUpdateToParent.

Transformations (mapping, combination, flat-mapping) would behave as normal if this setting is true (the default), and a value of false requires caching. If false, the transformation would not disturb the parent ObservableValue/Collection if the result of a reverse-mapped set operation was the same as the previous parent value.

This would allow collections to transformed and then modified such that the source data is not affected without any unnecessary (and possibly forbidden) update events to the source.

Updownquark commented 4 years ago

I made the assumption that this setting new option to false should require caching, but I can't think why that should be now. If the previous value can be determined dynamically (e.g. with a get call), caching should not be required.

Updownquark commented 4 years ago

I added this, but then realized that it has some fundamental issues. If a programmer uses this option without deeply understanding it, collections with this option may not fire updates. I've removed it from the general XformOptions, but it is present in FlatMapOptions where it still makes sense.