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:

654 questions
141
votes
7 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…
41
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
  • 858
  • 1
  • 9
  • 23
22
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,205
  • 2
  • 24
  • 39
19
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,434
  • 2
  • 33
  • 49
18
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
  • 17,083
  • 11
  • 66
  • 100
16
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…
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,301
  • 14
  • 29
15
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
  • 203
  • 2
  • 6
14
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
  • 17,083
  • 11
  • 66
  • 100
13
votes
3 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
  • 233
  • 3
  • 10
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
  • 3,862
  • 6
  • 33
  • 59
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
  • 16,119
  • 28
  • 99
  • 199
11
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
  • 40,521
  • 63
  • 217
  • 426
10
votes
2 answers

How to add a global error handler for all redux-observable epics?

I work on a React Native app using redux-observable. I have 10+ epics, all ending with .catch(err => console.error(err)) in order to display the React Native "Red box" (see https://facebook.github.io/react-native/docs/debugging.html#errors) in case…
ncuillery
  • 8,699
  • 2
  • 18
  • 27
9
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
  • 74,635
  • 166
  • 442
  • 756
1
2 3
43 44