acdlite / redux-rx

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

Allow more maintainers #18

Closed eudaimos closed 8 years ago

eudaimos commented 8 years ago

@acdlite

I greatly appreciate what you've done to get this started and I'm sure it came out of a passion for using RxJs with Redux/React for yourself. However, there are several simple clean up tasks that are going by the wayside due to how busy you are and it's preventing those interested from adopting a truly Reactive application from using your great and simple library.

My one request is that you open this up to maintenance by more people so that the following items can get done:

Personally, I'd be more than happy to perform these activities but at the moment I'm struggling with learning how to use this with my own new implementation of React+Redux Universal so I certainly can't provide help with examples

Thanks again!

chicoxyzzy commented 8 years ago

I agree with that. Repo should have collaborators.

Also

Document what other packages are necessary ( rx-react ?)

I don't think rx-react is necessary

or useful ( recompose

rx-recompose should be more useful IMO

chicoxyzzy commented 8 years ago

Our team is working on our own (closed source) implementation of rx bindings for redux but it will be much better if we could use this package. But we want it to be maintained more actively.

acdlite commented 8 years ago

Hi! Sorry I've let this project go by the wayside. I've gotten to the state recently where I have too many projects and not enough time to maintain them, so unless I'm using them actively they do indeed fall by the wayside.

I'm absolutely happy to open this up to collaborators. I've just added you as one :)

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.

acdlite commented 8 years ago

Btw what's your npm username? I'll add you there as well

acdlite commented 8 years ago

@chicoxyzzy I've added you as well

chicoxyzzy commented 8 years ago

@acdlite thank you. I'll try my best on it. My npm username is same as GitHub's one

acdlite commented 8 years ago

@chicoxyzzy Added on npm

eudaimos commented 8 years ago

@acdlite thank you for such a quick turnaround (which confirms my sending this before driving home :)

My npm username is also the same as my Github eudaimos

eudaimos commented 8 years ago

@acdlite per your comment above, can you please elaborate with a simple example (or more if you have time) for what you mean by using rx-recompose + observableFromStore(…) + .flatMap(…) aka .selectMany(…) in place of createConnector()

Do you mean something like:

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>);

Also per @chicoxyzzy 's comment, would this necessitate having a .dispose() method for observableFromStore() ?

acdlite commented 8 years ago

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;
  });
}
chicoxyzzy commented 8 years ago

Oh, I've missed that there is no curly braces there. @eudaimos I think we should create roadmap first to make it clear what we want redux-rx to be and move iterativly

eudaimos commented 8 years ago

thanks again @acdlite

I figured the way I was doing it I would create the storeState$ once using observableFromStore(…) and then pass it around like that allowing whatever to create their own filters from it to handle the state that individual component or other thing care about. That's how I would've done it with Rx in .NET at least.

Are you advocating that it's better to isolate (usually better) within single component code and have multiple Observables created against the store or just clarifying your example?

eudaimos commented 8 years ago

@chicoxyzzy good idea on the Roadmap - I'll start a new issue for it

eudaimos commented 8 years ago

@acdlite aside from more clarification to my last question above ^^ - were you able to add me to NPM?