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

How to test an inner Observable that will not complete?

I'm using jest to test a redux-observable epic that forks off an inner observable created using Observable.fromEvent and listens for a specific keypress before emitting an action. I'm struggling to test for when the inner Observable does not…
Pete
  • 87
  • 1
  • 7
4
votes
1 answer

redux-observable epic chain dispatches duplicate actions

Legend action-chain epic = Epic, which returns 'success' or 'fail' action, based on service call. service = Http service, from HttpModule, Angular2 The goal I need to send data to server. I have a CREATE, CREATE_SUCCESS and CREATE_FAIL actions. My…
Alex
  • 715
  • 1
  • 8
  • 29
4
votes
1 answer

rxjs throttle fetch until request has finished

I have an Observable that makes a request that gives back some information that is different each time. This observable is called by a user clicking a button. I want to prevent the user from clicking this button before the request has returned with…
andykais
  • 996
  • 2
  • 10
  • 27
4
votes
1 answer

How to chain actions and epics?

I'm familiar with React and Redux but quite new to RxJS and redux-observable. I'm working on a flow that I've managed to solve with something that looks like this: const reducer = (state, action) => { switch(action.type) { // some other cases…
4
votes
1 answer

How to handle `UnhandledPromiseRejectionWarning` when using Observable.from() and catching error in the Observable

I am using redux-observable together with isomorphic-fetch to handle http requests in my React app. I am favouring this combination over using rxjs' ajax because I am testing with Jest - which runs tests in Node.js- and want to intercept http…
mcmunder
  • 435
  • 1
  • 5
  • 11
4
votes
1 answer

RxJS v5: How to make a POST request with params?

I have some RxJS code and this is part of it: .mergeMap(action => { const user = store.getState().user; return ajax.post(`${config.API_BASE_URL}/api/v1/rsvps`, { rsvp: { meetup_id: action.payload, user_id: user.id, } }) …
bigpotato
  • 26,262
  • 56
  • 178
  • 334
4
votes
2 answers

How to delay one epic until another has emitted a value

In redux-observable I need to wait before doing an API request until another epic has completed. Using combineLatest doesn't work, nothing happens after APP_INITIALIZED finishes. I also tried withLatestFrom but neither works. const apiGetRequestEpic…
ddcc3432
  • 459
  • 1
  • 6
  • 16
4
votes
0 answers

react + redux + redux-observable + global handler for 401 errors?

Some newbie questions of how to handle unauthorisedin redux and redux-observable I have an application where user must be authenticated in order make requests to an api. If user provides token that is invalid, endpoint returns 401 http error…
gerasalus
  • 7,538
  • 6
  • 44
  • 66
4
votes
1 answer

Independent chain cancellation in redux-observable?

I'm new to RxJS. In my app I need independent cancellation of deferred action. Here's a working example (the delay is 3 seconds). But when I choose to delete multiple items and cancel one of them, then canceled all at once. Epic code: const…
Andy Pro
  • 55
  • 7
4
votes
1 answer

Dispatch an action in response to cancellation

I started with the cancellation recipe from the redux-observable docs and want to extend it a bit. Basically I have a scenario where after the cancellation is triggered, using takeUntil I want dispatch another action to cleanup, etc. This is what I…
winkerVSbecks
  • 1,173
  • 1
  • 10
  • 24
4
votes
1 answer

redux-observable multiple actions after 1st dispatch

I'm the 'registerEpic' utility described here: Is it an efficient practice to add new epics lazily inside react-router onEnter hooks? Our code needs to be isomoprhic, but on the server side, an action is triggered the 1st time and all is well. …
Ben
  • 16,124
  • 22
  • 77
  • 122
4
votes
1 answer

Is it an efficient practice to add new epics lazily inside react-router onEnter hooks?

When using redux-observable with react-router, would it make sense to asynchronously add new epics as per the instructions in the documentation here inside onEnter hooks of react-router during route changes? ./epics/index.js import { BehaviorSubject…
claireablani
  • 7,804
  • 5
  • 16
  • 19
3
votes
0 answers

Err Call Api on redux observable using Axios

I'm trying to learn redux-observables but I seem to be having an issue getting my app to return data. I keep getting the error below and I'm not sure where I'm going wrong or what the error actually means. I'm trying to learn redux-observables but I…
3
votes
1 answer

Catch all Pending or Rejected actions within a redux-toolkit slice

Aight.. so im pretty new with redux toolkit and I want to catch ALL pending actions in one slice to basically show a loading modal. I know we can do this with redux-saga and probably redux-observable Soooooo instead of …
Zohaib Ahmad
  • 87
  • 1
  • 6
3
votes
1 answer

How to type Actions for Redux-Observable's Epics with TypeScript

I'm setting TypeScript and Redux-Observable in my app and have this simple flow I'd like to apply here with an…
Utopiad
  • 107
  • 2
  • 13