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
10
votes
7 answers

RxJS: debounce a stream only if distinct

I want to debounce a stream - but only if the source value is the same as before. How would I do this with RxJS 5? I do not want to emit a value if the value is the same and I emitted it previously within a specified time window. I should be able to…
Craig Smitham
  • 3,395
  • 4
  • 31
  • 38
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
  • 14,308
  • 2
  • 22
  • 31
9
votes
1 answer

How to wait on / yield to multiple actions in single redux observable epic?

I have a redux Saga that runs three different actions every time 'WATCHLIST_FETCH_REQUEST' is dispatched: function* watchFetchWatchlist() { yield takeLatest('WATCHLIST_FETCH_REQUEST', fetchWatchlist); } function* fetchWatchlist() { const…
Jon Cursi
  • 3,301
  • 4
  • 27
  • 53
8
votes
2 answers

In redux-observable - How can I dispatch an action "mid-stream" without returning the value of that action?

I have searched everywhere and cannot find an answer to the following... In my addItemEpic I would like to dispatch a "loading" action before sending the ajax request - I DO NOT want the value of the action to be returned - I just want to DO the…
Rody Kirwan
  • 143
  • 1
  • 8
8
votes
1 answer

Redux Observable: How to use action.payload in latter part of chain?

I've ran into this issue quite a few times where I want to access action.payload further down the chain. But by then, the argument passed to mergeMap has already changed to something else. Given my action looks like this: { type: BUY_GEMS, …
bigpotato
  • 26,262
  • 56
  • 178
  • 334
8
votes
1 answer

Accessing the state from within a redux-observable epic

I am using redux to build a little fusball-manager. Basically it's a page that shows the score of both teams and some buttons to increment them. I have actions like { type:"GOAL_UP", team:"red" } for which the reducer will change the corresponding…
sra
  • 6,338
  • 3
  • 20
  • 17
7
votes
2 answers

Typescript discriminated union types with Rx.js filter operator?

Typescript supports discriminated unions. How to extend the same concept with Rxjs to the filter operator in below example? interface Square { kind: 'square'; width: number; } interface Circle { kind: 'circle'; radius:…
Harshal Patil
  • 17,838
  • 14
  • 60
  • 126
7
votes
1 answer

Using RxJS switchMap to only unsubscribe from streams with the same request URL/action payload (redux-observable epics)

I have an interface where the user may trigger calls to the same endpoint but with different params (in this case UUIDs). Up until now I've been enjoying the behavior of switchMap canceling my in-flight http requests whenever I dispatch a new redux…
7
votes
1 answer

Queue and cancel events using idiomatic redux observable

Given the example of a download manager. There can be any number of active downloads. Actions can be dispatched to start, stop, mark completion and mark the download progress of any particular download. const START_DOWNLOAD =…
Eamonn
  • 187
  • 2
  • 13
7
votes
1 answer

Is it possible to start/stop/resume a redux-observable epic by emitting actions?

This question may be about redux-observable or rxjs or both. I'm looking for a way to start, stop or resume an epic through specific actions. For example, the epic (that's already part of the epic middelware) will be active when the action {type:…
Huy Nguyen
  • 2,840
  • 1
  • 14
  • 18
7
votes
2 answers

Debouncing and cancelling with redux-observable

I am trying to create a simple redux-observable epic which debounces and is cancelable. My code: export const apiValidate = action$ => { return action$.ofType(validateRequestAction) .debounceTime(250) .switchMap((action) => ( …
Jonathan Sweetman
  • 605
  • 1
  • 6
  • 16
7
votes
1 answer

Using redux-observable and subscribing to a websocket

Trying to figure out how to get my epic going which will subscribe to a websocket and then dispatch some actions as the emitted events roll in from the websocket. The sample I see are using a multiplex and not actually calling a subscribe on…
Jordan McDonald
  • 1,101
  • 3
  • 14
  • 24
7
votes
2 answers

RxJS: Is there an no-op observable?

I have an action that will then trigger an ajax request. If the action fails for some reason, I want to do nothing. Instead of creating a blank action that just returns the previous state, is there a no-op function I can execute? export default…
bigpotato
  • 26,262
  • 56
  • 178
  • 334
7
votes
3 answers

React Native computational heavy task

Very simple and common use case, but I can't find satisfying answer. I have react native app which needs to store some data locally. I am using redux and redux-observables and Realm as a storage. What I need is: some action occur, let's say…
7
votes
1 answer

Flow type checking a action$ observable

Is it possible to flow type check an observable? I am using redux-observable to build out epics that watch for actions to dispatch and, if there is a match, they run some async code. The action$ argument to the epic is an observable, but there seems…
Jon Cursi
  • 3,301
  • 4
  • 27
  • 53
1
2
3
45 46