From a comment by @chicoxyzzy in #18 - a chance for those actively using this library to weigh in on what gets done next.
My thoughts are (reprinted/modified from #18):
Not necessarily in that order.
Also some comments from @acdlite in that issue thread that modify the list above:
In addition to the sensible steps you've listed like pushing the changes to the middleware API, my suggestion is that createConnector() should be removed in favor of using rx-recompose (or similar) directly. That project + observableFromStore() + .flatMap() gives you all the power you need, and would allow the library to be view framework agnostic.
In response to my example which is
import Redux from 'redux';
import { Observable } from 'rx';
import { observableFromStore } from 'redux-rx';
import { observeProps } from 'rx-recompose';
const storeState$ = observableFromStore(store);
const fooState$ = storeState$.map(state => state.fooKey).distinctUntilChanged(fstate => fstate.id);
const FooCtor = observeProps(props$ => {
return Observable.combineLatest(props$, fooState$, (props, fooState) => Object.assign(props, fooState);
});
const Foo = FooCtor(<div>…</div>);
- I'm not sure where to use
.flatMap(…) above and could use some assistance on that
- I'm not sure if I'm implementing it right using
Object.assign(…)
he also wrote
Yeah, if you do it like that you don't need .flatMap(). I was thinking about a situation like this, where you grab the store from the stream of props:
const enhance = compose(
getContext({ store: PropTypes.object }),
observeProps(props$ => {
const storeState$ = props$.flatMap(props => observableFromStore(props.store))
// ...
})
)
observableFromStore() already supports disposal because the function passed to Observable.create() returns an unsubscribe function. Admittedly, this isn't exactly clear from the source, but here's the longer version:
export default function observableFromStore(store) {
return Observable.create(observer => {
const unsubscribe = store.subscribe(() => observer.onNext(store.getState()));
// By returning unsubscribe, the observable can be disposed
return unsubscribe;
});
}
Is there anything else you'd like to see?
What's immediately needed for your project?
What do you want longer term?
From a comment by @chicoxyzzy in #18 - a chance for those actively using this library to weigh in on what gets done next.
My thoughts are (reprinted/modified from #18):
npm install redux-rxinstalls version0.5.0but the latest Release for the repo is tagged as0.4.0, neither of which have the fix for the Middleware APIimportstatements at the top and an example of how to use it withreact-redux, specifically:createConnectorexample by showing how it is used with theTodocomponentobservableMiddlewaredoesn't even includeobservableMiddlewarein the examplerxandreduxpeer dependenciesNot necessarily in that order.
Also some comments from @acdlite in that issue thread that modify the list above:
In response to my example which is
he also wrote
Is there anything else you'd like to see?
What's immediately needed for your project?
What do you want longer term?