acdlite / redux-rx

RxJS utilities for Redux.
1.01k stars 44 forks source link

Roadmap for Future Development #19

Open eudaimos opened 8 years ago

eudaimos commented 8 years ago

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?

chicoxyzzy commented 8 years ago

should we update RxJS to 5 version?

thebarndog commented 8 years ago

@eudaimos the immediate needs for my project(s) is pushing out the middleware function fix to npm.

As far as long term, now that there's a few more updates, seeing regular updates would be fantastic. It's too bad that the original creator is so busy because he's made some awesome stuff like this library, redux-actions, etc.

I would say the biggest thing this project needs apart from the bug fix I mentioned previously and more people is some ol' fashioned TLC. The docs are in a state of dis-repair as you mentioned and it would be very helpful to have examples on how the observable middleware is used (for example).

In terms of priorities, I would say:

1) Pushing middleware bug fix as npm release 2) Doc cleanup/more examples 3) Discussion regarding updating to latest version of RxJS 4) More collaborators

leesiongchan commented 8 years ago

+1, looking forward.

marcuswhit commented 8 years ago

Getting the latest working version published is clearly #1 - any ETA on that?

Otherwise your list is good - this is a very useful library and it'd be a shame to see it fade away!