Questions tagged [redux-observable]

redux-observable is a redux middleware for performing side effects (epics) using RxJS.

redux-observable is a redux middleware for performing side effects (epics) using RxJS.

Developer documentation and resources:

683 questions
149
votes
6 answers

Why use Redux-Observable over Redux-Saga?

I have used Redux-Saga. Code written with it is easy to reason so far, except JS generator function is messing up my head from time to time. From my understanding, Redux-Observable can achieve the similar job that handles side effects but without…
47
votes
2 answers

redux-observable - dispatch multiple redux actions in a single epic

I'm looking for way of dispatching multiple redux actions in a single Epic of redux-observable middleware. Let's assume I have following Epic. Everytime when SEARCH event happens, Epic loads data from backend and dispatches RESULTS_LOADED…
dotintegral
  • 918
  • 1
  • 10
  • 23
24
votes
3 answers

Is there any place for OOP in redux?

I've been using object-oriented programming practices for 25 years and trying to move toward functional programming for the last 5 years, but my mind always goes towards OOP when I'm trying to do something complex and, especially now that ES6…
Sigfried
  • 2,943
  • 3
  • 31
  • 43
23
votes
4 answers

RxJS iif arguments are called when shouldn't

I want to conditionally dispatch some actions using iif utility from RxJS. The problem is that second argument to iif is called even if test function returns false. This throws an error and app crashes immediately. I am new to to the power of RxJS…
E1-XP
  • 363
  • 1
  • 3
  • 10
22
votes
1 answer

Wait for sequence of action with a Redux Observable

I have a use case where I need to wait for a sequence of actions before I dispatch another using Redux Observables. I've seen some similar questions but I cannot fathom how I can use these approaches for my given use case. In essence I want to do…
Matt Derrick
  • 5,674
  • 2
  • 36
  • 52
19
votes
2 answers

How to debug rxjs5?

On RxJS - Goals I read that their goal is better debuggability: Goals Provide more debuggable call stacks than preceding versions of RxJS I have just started to use redux-observable which is quite easier for me to understand comparing it to…
Amio.io
  • 20,677
  • 15
  • 82
  • 117
17
votes
2 answers

Cancel previous requests and only fire the latest request with redux observable

So I have use case where I update the api request when the map is moved - but it could generate several rapid fire requests with small map movements - and I want to cancel all the inflight requests except for the last one. I can use debounce to…
MonkeyBonkey
  • 46,433
  • 78
  • 254
  • 460
16
votes
1 answer

redux-observable Promise is not getting resolved in unit test

I am trying to test this epic https://github.com/zarcode/unsplashapp/blob/master/src/epics/photos.js . Problem is that map never happens when I run test (which I assume means that Promise never resolves), so photosSuccess action never happens…
zarcode
  • 2,465
  • 17
  • 31
16
votes
1 answer

How to handle multiple action types in one epic? Any cons of doing the same?

Pretty new to redux-observables, rxjs and observables. Wanted to know how can I handle another action, say 'ActionTwo' in the same epic const Epic1 = (action$,store) => { return action$.ofType('ActionOne') .mergeMap((action) => { return…
Ajinkya Salve
  • 213
  • 1
  • 2
  • 6
15
votes
2 answers

Use fetch instead of ajax with redux-observable

In redux-observable is it possible to use isomporphic-fetch instead of Rx.DOM.ajax?
Amio.io
  • 20,677
  • 15
  • 82
  • 117
14
votes
4 answers

redux-observable you provided 'undefined' where a stream was expected

I'm using the fbsdk to get user details in an ajax request. So it makes sense to do this in a redux-observable epic. The way the fbsdk request goes, it doesn't have a .map() and .catch() it takes the success and failure callbacks: code: export const…
11
votes
3 answers

React + Redux-Observable + Typescript - Compilation, Argument Not Assignable Error

I am creating an app using React and Redux-Observable. I am new to this and I am trying to create an epic to execute the user login. My epic is below: export const loginUserEpic = (action$: ActionsObservable) => action$.pipe( …
Felipe
  • 6,312
  • 11
  • 52
  • 70
11
votes
2 answers

eslint error : Cannot find any-observable implementation nor global.Observable

I've installed latest "rxjs": "6.2.2", and "redux-observable": "1.0.0",. I have precommit hook that does eslint checks. After installation is started to throw this error: C:\XXX\node_modules\any-observable\register.js:29 throw new…
dragonfly
  • 17,407
  • 30
  • 110
  • 219
10
votes
5 answers

How to dispatch multiple actions from redux-observable?

I want to dispatch multiple actions from a redux-observable epic. How can I do it? I originally started with const addCategoryEpic = action$ => { return action$.ofType(ADD_CATEGORY_REQUEST) .switchMap((action) => { const db =…
Jiew Meng
  • 84,767
  • 185
  • 495
  • 805
10
votes
1 answer

How to perform side-effect inside of an epic in redux-observable?

In redux-observable, epics are accepting stream of actions and returning back new stream of actions. In my use-case I need to send analytics event after some action was dispatched and do nothing after. With redux-saga, I can just listen that action…
1ven
  • 6,776
  • 1
  • 25
  • 39
1
2 3
45 46