redux-observable / redux-observable

RxJS middleware for action side effects in Redux using "Epics"
https://redux-observable.js.org
MIT License
7.85k stars 467 forks source link

Constructing `StateObservable`s without `stateSubject` #570

Open OliverJAsh opened 6 years ago

OliverJAsh commented 6 years ago

Do you want to request a feature or report a bug?
potential bug

What is the current behavior? I am constructing my own StateObservables and the stateSubject parameter asks for a Subject, but it seems it only needs an Observable: https://github.com/redux-observable/redux-observable/blob/fecf1455f5f68e6a3b164a21b6f7dad05c8882b0/src/StateObservable.js#L4

Is it safe to rename the parameter to state$ and pass in Observables instead of Subjects? Or is there a good reason to keep it how it is?

For context, the reason I am constructing my own StateObservable relates to #562.

jayphelps commented 6 years ago

It's totally safe to pass in an plain Observable that is not a Subject. Changing the name wouldn't be a breaking change since it's an internal detail so that's also cool too, though I wouldn't call it state$ because that's what StateObservable itself is usually referred to as and IMO that's confusing. RxJS itself would usually call that parameter source

OliverJAsh commented 6 years ago

Good to know, thanks. I'll raise a PR to rename the param and correct the type.