ReactiveX / rxjs

A reactive programming library for JavaScript
https://rxjs.dev
Apache License 2.0
30.77k stars 3k forks source link

Consider adding operator that aliases map().distinctUntilChanged() and pluck().distinctUntilChanged() #1832

Closed MikeRyanDev closed 7 years ago

MikeRyanDev commented 8 years ago

In a couple of "state as an observable" libraries there is an implementation of an operator typically called something like select that acts like an alias for map(fn).distinctUntilChanged() or pluck(...keys).distinctUntilChanged().

See: ngrx/store: https://github.com/ngrx/core/blob/master/lib/operator/select.ts ng2-redux: https://github.com/angular-redux/ng2-redux/blob/master/src/components/ng-redux.ts#L105 fluorine: https://github.com/philpl/fluorine/blob/master/src/distinctSelector.js

It would be great if a common, consistent version of this operator were in rxjs proper.

cc @robwormald @SethDavenport @e-schultz @philpl

kitten commented 8 years ago

I'm not sure if I have an opinion on this, but I'm here to mention that the distinctSelector doesn't do the same thing as ngrx/store's or ng2-redux's select.

Rather than selecting a single (optionally nested) property, it extracts a set of properties in an emitted object and only emits when one of these changes. So it basically selects a sub-set of an object and applies a reference equality check to each property.

benlesh commented 7 years ago

closing as inactive

lock[bot] commented 6 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.