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

is it ok to change the route programatically inside an epic in redux-observable

I am using redux-observable and in my epics I am changing the route in some of them using browserHistory.push. Is this standard/good practice? my gut feeling tells no, however need your opinion. In addition to this after upgrading to…
tmp dev
  • 8,043
  • 16
  • 53
  • 108
5
votes
1 answer

Cannot read property 'type' of undefined (react-router-redux)

I am trying to redirect to the page after signing out. However, every time when I sign out, it directs the page successfully. However, I still got the error Cannot read property 'type' of undefined Further research by "Pause on Caught Exceptions",…
Hongbo Miao
  • 45,290
  • 60
  • 174
  • 267
5
votes
1 answer

Redux Observables / RxJS: How to make epic that returns different actions based on if / else?

I am trying to hook up my app with in app purchases using this: https://github.com/chirag04/react-native-in-app-utils I have an epic where I want to emit success if it succeeds, and failure if it fails. Something like this: import 'rxjs'; import {…
bigpotato
  • 26,262
  • 56
  • 178
  • 334
5
votes
2 answers

Concurrent Ajax requests with Rxjs

I'am currently switched from promises to observables. I am using Redux-Observable for my react app. Basically, I am looking for the best operator that will enable mutliple, concurrent ajax calls and return the responses when all the observables have…
grustamli
  • 396
  • 4
  • 16
5
votes
1 answer

Firing multiple actions on catch error

I am struggling to figure out how to fire multiple actions in a catch error handler in my epics. I have successfully figured out how to fire multiple actions on a successful async call in my epics using the thunk-middleware. See below: const…
Adam Duro
  • 882
  • 1
  • 9
  • 21
4
votes
1 answer

Redux-Observable: modify state and trigger follow up action

I have the following scenario in redux-observable. I have a component which detects which backend to use and should set the backend URL used by the api-client. Both the client and URL are held in the global state object. The order of execution…
light_303
  • 2,101
  • 2
  • 18
  • 35
4
votes
2 answers

Fire multiple actions and wait for them to resolve RxJS / Redux Observables

I have an action that I want to use to initialise my app, I want to create an epic for this action and then fire multiple other actions off the back of this, wait for them to all complete and there fire another action. I had a look at other…
woolm110
  • 1,194
  • 17
  • 27
4
votes
1 answer

redux-observable use RxJS to emit progress actions for ajax call

I have been wrestling with this problem and feel like I have a fundamental misunderstanding. I am using the redux-observable library in React which glues redux together with RxJS for handling asynchrony. My problem is that I have to handle a large…
Matthew Crews
  • 4,105
  • 7
  • 33
  • 57
4
votes
1 answer

How to get previous state in the epic

Is there a way in an epic to receive previous state of the store? I feel you can't as the epic stands at the end of the Action -> Reducer -> Epic queue. REMEMBER: When an Epic receives an action, it has already been run through your reducers and…
Lukasz 'Severiaan' Grela
  • 6,078
  • 7
  • 43
  • 79
4
votes
1 answer

RXJS redux observable perform multiple api calls

I have an array of contacts and would like to perform an API calls for each object in the contacts array. I have tried to loop over each item and make the call to fetchJson$, however, I realise that this approach is incorrect. What is the correct…
Laurie Williams
  • 383
  • 2
  • 8
4
votes
1 answer

How to use rxjs ajax operator instead of axios in my react project?

I am new to rxjs and want to know how to handle this use case. This is axios promise, how to convert it so that it uses rxjs's ajax operator export const onLogin = ({ username, password }) => axios({ method: "post", url: O_TOKEN_URL, …
Sabbiu Shah
  • 1,569
  • 3
  • 16
  • 28
4
votes
3 answers

How to prevent starting the same call twice from epic

My epic wakes up when the REMOTE_DATA_STARTED action is dispatched and it fetches data using action.url and action.owner. I need to make sure I don't initiate two concurrent calls to the same owner/url. Once the call for a owner/url is completed,…
Sylvain
  • 19,099
  • 23
  • 96
  • 145
4
votes
1 answer

What is the purpose of ActionsObservable in redux-observable

I don't quite understand what is the purpose of ActionsObservable. There's nothing about it in the documentation but I see it being used here and there in examples. Why not just use: import { of } from 'rxjs/observable/of'; or import { from } from…
Tomasz Mularczyk
  • 34,501
  • 19
  • 112
  • 166
4
votes
1 answer

Conditionally fetching data in epic

Say I have the following epic: const getPostsEpic = (action$, store) => { return action$.ofType(actionTypes.REQUEST_POSTS) .switchMap(action => ajax.getJSON(`api/posts?key=${action.key}`) .map(response => …
simen-andresen
  • 2,217
  • 4
  • 25
  • 39
4
votes
2 answers

How can I test Observable.ajax (redux-observable)?

I have been playing with rxjs and redux-observable for the last few days and have been struggle to find a way to a test for Observable.ajax. I have the following epic which create a request to https://jsonplaceholder.typicode.com/, export function…
binkpitch
  • 677
  • 1
  • 8
  • 18