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
6
votes
3 answers

React observable epic with Redux Toolkit and Typescript

I'm not sure how to write a React observable epic with Redux Toolkit and Typescript. Suppose I have this authSlice: import { CaseReducer, createSlice, PayloadAction } from "@reduxjs/toolkit"; type AuthState = { token: string, loading:…
edoedoedo
  • 1,469
  • 2
  • 21
  • 32
6
votes
4 answers

How to listen to redux action stream in component

I'm working on a React application that uses the following architecture: redux typesafe-actions redux-observable My question is: How can I execute an UI action on specific redux action? For example, suppose we have the following async actions…
charlee
  • 1,309
  • 1
  • 11
  • 22
6
votes
2 answers

How to use Firestore realtime updates (onSnapshot) with redux-observable/rxjs?

I am able to setup redux-observable with normal Firestore queries export const getStatementsEpic = (action$, store) => { return action$.ofType(GET_STATEMENTS) .filter(() => { const state = store.getState() return state.auth.user …
Jiew Meng
  • 84,767
  • 185
  • 495
  • 805
6
votes
1 answer

RxJS: takeUntil with multiple actions and different filters?

I have an Observable that I want to continue executing until: 1) the uploadActions.MARK_UPLOAD_AS_COMPLETE action is called with a certain payload OR 2) the uploadActions.UPLOAD_FAILURE action is called with any payload This is as far as I could get…
bigpotato
  • 26,262
  • 56
  • 178
  • 334
6
votes
2 answers

Redux Observable throttle Ajax requests only some conditions met

In my reactjs redux application I'm using redux observable epics middleware for ajax requests to cancel some requests. const epicRequest = $actions => { return $actions .ofType(MY_ACTION_TYPE) .debounceTime(500) …
6
votes
1 answer

Should we create one Epic per action type? in redux-observable

I am in process of redux-observable learning, and I have some doubts: Should we create an Epic for each action to watch? export const actionEpic = action $ => action$.ofType('ACTION') export const action2Epic = action $ =>…
MatCas
  • 773
  • 8
  • 19
6
votes
1 answer

redux-observable epic that doesn't send any new actions

Might be that I'm a noob and not fully understanding how this stuff should work yet, but I have an epic in redux-observable in which I want to use as a way to create a promise which will dispatch an action and wait for a different action before…
Ben
  • 16,124
  • 22
  • 77
  • 122
5
votes
2 answers

return EMPTY crash my redux observable chain

I am using redux, redux-observable. I have the following import { EMPTY, Observable } from "rxjs"; const setCurrentDatastoreIdEpic = (action$, state$): Observable => action$.pipe( ofType(DatastoreActions.setCurrentDatastoreId), …
Bobby
  • 4,372
  • 8
  • 47
  • 103
5
votes
2 answers

Can't use redux-observable with Stencil@one : "Class constructor Observable cannot be invoked without 'new'" error on ActionsObservable class

I have a Stencil component library using @Stencil/redux, redux, redux-observable and redux-actions. Everything worked fine before but I'm trying to upgrade to Stencil@One (1.0.0-beta.5). I have now an error during the Redux store creation. This is…
Elvynia
  • 337
  • 2
  • 11
5
votes
1 answer

redux-observable - difference between concat vs concatMap

I am trying to wrap my head around the difference between concat and concatMap when using redux-observable. In my intuition, I'm thinking that concatMap would work: - From a FAKE_LOGIN action, it will be switchMap-ed to emit…
Mudd
  • 97
  • 3
  • 8
5
votes
2 answers

TypeError: action$.ofType(...).mergeMap is not a function

I am new to reactjs and trying to integrate redux with my existing project. This is my index.js file in store import 'rxjs' import { createStore, combineReducers, applyMiddleware } from 'redux' import { reducer as formReducer } from…
Dark Knight
  • 995
  • 4
  • 22
  • 48
5
votes
1 answer

rxjs v6 / redux-observable v1.0.0: Operators not working in epic

I am using the latest version of redux-observable and Rxjs i.e // My version "redux-observable": "^1.0.0", "rxjs": "^6.3.2" The store - middleware, setup looks like this: // Setting up middlewares import { pingEpic } from './epics'; import…
5
votes
0 answers

error on createEpicMiddleware

When I call createEpicMiddleware(epic) function on Angular2+, there is an error: "error TS2560: Value of type '(action$: any) => any' has no properties in common with type 'Options'. Did you mean to call it?" Even if using the sample official…
jisu lee
  • 81
  • 1
  • 3
5
votes
0 answers

Type 'Dispatch' is not assignable to type 'Dispatch'

hello i'm try to user redux with angular. but i have this error message when i try to run my angular app: ERROR in node_modules/@angular-redux/store/lib/src/components/ng-redux.d.ts(10,31): error TS2420: Class 'NgRedux' incorrectly…
5
votes
1 answer

Alternative to direct calling of store.dispatch()

Since in the latest redux-observable (0.17) is direct calling of store.dispatch() deprecated, I wonder what is an alternative if I need to dispatch actions from the outside of my redux app. Example: Let's say I have this function which initialize…
trubi
  • 295
  • 2
  • 14
1 2
3
45 46