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
3
votes
1 answer

Dispatching additional actions conditionally from redux-observable epic

In short, I’d like set up an epic that performs a request and dispatches an action based on the request being fulfilled or rejected. Then I'd like the epic to maybe dispatch additional action(s) based on the result and the current state. First part…
Voidsheep
  • 67
  • 7
3
votes
3 answers

How to import multiple things in javascript

I want to import multiple things in js, I have tried with import * like this: the export file AppEpics.js: export fooEpic = Observable.of() // some fancy code; export barEpic = Observable.of() // some other fancy code; the import file: import * as…
leuction
  • 563
  • 2
  • 8
  • 19
3
votes
2 answers

Composing and sequencing multiple epics in redux-observable

I have a problem that I don't know how to resolve. I have two epics that do requests to api and update the store: const mapSuccess = actionType => response => ({ type: actionType + SUCCESS, payload: response.response, }); const mapFailure =…
Tomasz Mularczyk
  • 34,501
  • 19
  • 112
  • 166
3
votes
3 answers

store defaultstate with redux observable middleware

I am making a redux observable epic as middleware, and also want to provide a default state to store. At some places I have seen applyMiddleware as third argument to createStore function whereas at some places it is second argument. How can I…
madhur
  • 973
  • 1
  • 14
  • 23
3
votes
1 answer

How to use forkJoin correctly in redux-observable?

I am using redux-observable. I am trying to send mail after all attachments be uploaded separately. The process of this send mail API is Add mail content to the draft Add attachments separately to the draft Once all attachments are uploaded, send…
Hongbo Miao
  • 45,290
  • 60
  • 174
  • 267
3
votes
3 answers

combineEpics using TypeScript gives type error

I am getting this error when combining my epics: TS2345: Argument of type 'Epic' is not assignable to parameter of type 'Epic'. Type 'SessionAction' is not assignable to type…
Juan Bernal
  • 97
  • 1
  • 11
3
votes
1 answer

Reimplement redux observable with only RxJs?

I am trying to see (out of curiosity) how complex it would be to reimplement basic redux / redux-observable behavior with pure Rxjs. Here is my take on it, but it seems incredibly too simple to be right. Can anyone point me at any errors/flaws in…
TheoH
  • 73
  • 5
3
votes
3 answers

Narrowing type inside Observable

Short explanation I want to be able to write actions$.ofType().map(a => ...) instead of actions$.filter(a => a.type === ActionType.MY_ACTION).map((a: MyAction) => ...). Background I'm trying to save some boilerplate when working with Redux…
Magnus Grindal Bakken
  • 2,083
  • 1
  • 16
  • 22
3
votes
1 answer

sequencing epics in redux

I have two epics, epicA and epicB. B is subject to back-pressure since the api calls associated with it are slower. (uploads) However, I need to make sure that all of the api requests that come from B complete before A. so if the requests…
Anthony Chung
  • 1,467
  • 2
  • 22
  • 44
3
votes
1 answer

Sequence of actions with redux-observable

Here's the flow I want to implement: the list of all users is publicly available on my backend API, so I wish to see if the user already exists, if no, create a new user. I'm using Redux, and I'm managing side effects with redux-observable. Here's…
jeanpaul62
  • 9,451
  • 13
  • 54
  • 94
3
votes
1 answer

RxJS Redux-Observables Test retryWhen inside an epic

I'm struggling on how to test the retryWhen operator in a redux-observable epic. Based on this example taken from docs, I forked this jsbin where I'm trying to test the case where the response fails 2 times and after that it returns a valid…
stelioschar
  • 115
  • 1
  • 2
  • 10
3
votes
1 answer

How to use redux-observable and promise correctly?

I am using hello.js to sign in. hello('abc').login() returns a promise. It did sign in successfully, because hello.js itself saved the token in the local storage. However, the code below sometimes does not dispatch the action SIGN_IN_SUCCEED. export…
Hongbo Miao
  • 45,290
  • 60
  • 174
  • 267
3
votes
1 answer

Epic doesn't react on action from another epic

I have a problem with redux-observables. In my situation one epic wait for ending of another epic. The second epic can make a request or return data from the cache. When second makes the request all work as expected, but when it returns cache the…
3
votes
2 answers

In redux-observable, how do I control whether the reducers or epics react to an action first?

E.g. for certain actions, I want the reducers to process it before the epics do. And vice-versa for other actions. Is there a way to do this?
Leo Jiang
  • 24,497
  • 49
  • 154
  • 284
3
votes
1 answer

Emit action, then request and emit another with redux-observable and rxjs

So, I have an epic that receives a SUBMIT_LOGIN action and then it should fire the generateDeviceId function that returns an action with an id as payload. After that is processed by the reducer and the store is updated, it should request the login,…