Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
  • Jan 11 15:54

    jayphelps on master

    chore: remove mention of future… (compare)

  • Jan 11 10:09
    OliverJAsh opened #759
  • Dec 28 2021 20:38
    parav01d opened #758
  • Dec 23 2021 11:01
    Whazor commented #706
  • Dec 23 2021 04:47
    rgbkrk commented #706
  • Dec 02 2021 02:14
    morsmodr commented #412
  • Dec 02 2021 02:14
    morsmodr commented #412
  • Dec 02 2021 01:48
    morsmodr commented #412
  • Dec 02 2021 01:47
    morsmodr commented #412
  • Dec 02 2021 01:46
    morsmodr commented #412
  • Dec 02 2021 01:28
    morsmodr commented #412
  • Dec 02 2021 01:27
    morsmodr commented #412
  • Dec 02 2021 01:25
    morsmodr commented #412
  • Oct 24 2021 09:25
    floroz edited #757
  • Oct 24 2021 09:25
    floroz edited #757
  • Oct 24 2021 09:25
    floroz opened #757
  • Oct 10 2021 09:29
    omerts edited #756
  • Oct 10 2021 09:29
    omerts opened #756
  • Oct 10 2021 09:27
    omerts closed #755
  • Oct 10 2021 09:24
    omerts opened #755
yes I'm using typescript, now there are a lot type warnings
Oskar Thornblad
Hi, I've got experience in NgRx effects to I thought redux-observable would be a piece of cake to get working.. but I can't get the simplest Epic to properly compile due to unknown always popping up no matter what combination of magic I try! Anyone see anything obvious?
I've tried ofType, manually filtering on action.type etc, it all properly filters the correct action.. ..but I end up with the "..but unknown!!" errors
(I've also tried doing it without redux-toolkit with just plain objects and a simple union for the action types)
Similar error of ofType any solution for the above problem
Hello. Can you explain, please, why epic Output extends Input? Source. If payloads of input/output actions mismatch, typescript says that Output.payload is not assignable to type Input.payload
Kevin Ghadyani

It seems like a lot of issues today are related to TypeScript, RxJS 7, and Redux-Observable 2.

I usually answer many of the questions here, but I'm not versed in any of the new stuff nor have I used TypeScript or any recent RxJS or Redux-Observable.

In the past, most questions revolved around "how do I do X in Redux-Observable" which are easy for me to answer. These ones require more knowledge of the technical side of things.

Has anyone gotten the new tech working in their projects?

Alessandro Savino
Hi, I'm having a strange behaviour from redux-observables and need some new ideas. I moved the app under the electron-forge framework (and reached a working setup where epics were working). Then I started improving the redux states and actions, also involving redux toolkit. Now, all of a sudden, the epics stop firing (also following the trobleshooting and placing the tap on them, I do not see any log. What could have I done wrong or missing that needs checking?
Per Sandstrom

Im trying to migrate to rxjs 7 and redux-observable v2. The simplest epics are easy to migrate, but I'm having trouble with race. For example this code:

const waitForGetStuffObservable = race<Stuff.ResponseAction | Stuff.ErrorAction>(
    .pipe(mapTo(Stuff.createErrorAction(createServiceError({}), q)))

My own attempt is this:

const waitForStuffObservable = race(
  pipe(ofType(StuffType.RCV_GET_STUFF), mapTo(Stuff.createResponseAction())),
  pipe(ofType(StuffType.ERR_GET_STUFF), mapTo(Stuff.createErrorAction(createServiceError({}), q)))

But I just get an error that UnaryFunction is not assignable to ObservableInput. Any idea how to fix this?

1 reply

Hi everybody, does anyone know why the console.log() is not being printed on the console?
I am new to redux-observable and I am trying to understand how it does work.

Does it have to be with an action that is not being called, If so, how could I call that action in order to execute this console.log()?

Thanks for your help!!

const getEpic$: Epic<SetOptions, SetOptions, RootState> = (action$, state$) => action$.pipe( ofType(setOption.type), withLatestFrom(state$), switchMap(([action, state]) => { console.log('why is not getting into here?', { action, state }); }) );

Kevin Ghadyani

Epics are functions that return observables, not observables themselves. Put a tap(console.log) before ofType(setOption.type). That will help debug if you're seeing any actions. If you are, then move it down a step until it stops firing.

That should help you debug.

@Sawtaytoes Hi, log worked before ofType(), but it did not after
why is not the action being dispatched? that´s what I believe its happening
Nisim Joseph

hi, question about the Epic signature, for TS code.
the signature is:

export declare interface Epic<
  Input extends Action = any,
  Output extends Input = Input,
  State = any,
  Dependencies = any
> {

and I am force to have the Output action to derived from Input action.
why is that?
why do I limited to it?

Kevin Ghadyani

@Sawtaytoes Hi, log worked before ofType(), but it did not after

@ChristherNand I'd check 2 things. In Redux Devtools, make sure the action is getting dispatched. If not, then that's step 1. If it is getting dispatched, make sure the value passed to ofType is correct.

Most-likely, your value isn't getting dispatched because you've got something preventing it from being dispatched. Can you share the code where you're dispatching it?


Hi, this might be a stupid question, but having trouble implementing a debounce search function using redux-observable.
My current setup is something like this every time the query changed it will dispatch an action, the action will be piped down an epic like follow. Note that the search(action.payload.query) is an action creator

export const onSearchChangedEpic: Epic<AllActions> = (action$) =>
    debounce((action) => {
      // Dispatch an action immediately if the query is empty.
      if (action.payload.query.length === 0) {
        return EMPTY;
      return timer(500);
    map((action) => {
      if (action.payload.query.length === 0) {
        // Clear search results.
        return resetResults();
      return search(action.payload.query);

The expected result is when I stop typing for a period (500 ms) a search() action will be piped, but what happen is the debounce timer will always reset when i type. So if I type 5 character, it will debounce for 5 time (2500 ms) before piping out a search result

Is there anything i can do to get the expected behaviour? ( when I stop typing for a period (500 ms) a search() action will be piped)

1 reply
Hello guys , I am trying to implement rxjs websocket , using redux observable .I came across this article which helped me implement same. But the issue here is in my companies codebase the epic are written differently than this article . https://techinscribed.com/websocket-connection-reconnection-rxjs-redux-observable/ . Is this two epic equal ?
André Vitor de Lima Matos
Hello. I'm having some serious memory leak issues with the QueueScheduler usage in redux-observable@2 with rxjsw@7. We do some heavy subject usage in our codebase (some ReplaySubject(1) in deps, among others), although we avoid at maximum explicit subscribes and try to leave everything for the global subscription. Nonetheless, it seems QueueActions are pilling up and clogging memory heavily. We checked and it seems subscriptions are not leaking (all subjects's observers, including internal redux-observables subjects, are constant in number), but QueueAction, and observeOn's OperatorSubscribers instances makes our memory usage skyrocket, and these actions are not freed. Most of it seems to be references in _teardowns. Removing queueScheduler usage on redux-observable makes the problem disappear, but it may be triggered by something we do. Does anyone have experience with this kind of issue? If not, I may try to prepare a self-contained repro to open an issue
André Vitor de Lima Matos
André Vitor de Lima Matos
memory leak fixed by rxjs@7.3.1
Abhishek Kumar
For testing inside run, both hot and cold are passing the test. So which is the correct one to use for testing of Epics and what do Hot and Cold means in context of "redux-observables" as a middleware for redux
Has anyone implemented SSR with NextJS on an app that uses React, Redux and Redux Observable?
My application uses RO as an infinite side-effect manager, and currently the only SSR example is using a Subject and shutting it down after all epics are done
This makes sense if the epics were implemented to be solely for async tasks and ended after the async task was done
If I use the example implementation, my SSR solution times out as the epics never end :)