Use Stack Overflow for Teams at work to find answers in a private and secure environment. Get your first 10 users free. .

Questions tagged [redux-saga]

Redux-saga is a redux middleware library which designed for handling side effects in redux applications. It provides developers with the ability to manage asynchronous code synchronously.

Filter by
Sorted by
Tagged with
1
vote
1answer
12 views

Difference between testSaga and expectSaga in redux-saga-test-plan

Is it correct to say that expectSaga is for integration testing and testSaga is for general assertions? In reality, I can actually use them interchangeably for all my tests, so I am a bit confused ...
0
votes
0answers
6 views

using redux saga for facebook login

I have a saga written that will do authentication with Facebook and everything works as expected. However, now I am trying to augment my saga to hit a server endpoint when signing the user in. At a ...
0
votes
1answer
13 views

Redux Saga Redirect to Wordpress Page

I have a React App as a submodule in a Wordpress repo. The React App is responsible for inventory and all its pages while Wordpress is responsible for all other pages. I have a saga function that ...
0
votes
0answers
15 views

How to create Redux Saga that returns a payload

Hello I would like to know what is wrong with my code: Even though my ajax request works, the payload object is always undefined. If I understand sagas correctly the fetchWord function should wait ...
2
votes
1answer
51 views

How to test redux-saga's generator that calls external api?

I'm complete beginner when it comes to writing tests, yet I have been given task to test some api's implementation, which is done using redux and redux-saga. The scenario is that user fills prepared ...
0
votes
0answers
19 views

How to cancel all running sagas when navigating between page views

I'm trying to find a simple and easy way to cancel all running sagas within a "page" when the user decides to navigate to another "page" within the app... We are not using routing, but instead each "...
2
votes
1answer
30 views

dispatch action inside saga watcher after Meteor.call

I want to dispatch action inside Meteor.call callback. I'v tried to pass generator function as callback, but does not work. function* createRegistrationField(action: CreateRegistrationFieldRequest) ...
0
votes
2answers
30 views

redux-saga: wait for dispatch to be completed

I'm using redux-saga to list and update a list of items stored in a remote server. And I would like to create an item and then to list the items. That is: import { connect } from 'react-redux' const ...
0
votes
0answers
11 views

How to fix “TypeError: Cannot read property 'then' of undefine” during SSR in React-Redux App with redux-saga

I'm very new in React-Redux Apps and trying to implement Server Side Rendering in my App. I use redux-saga, webpack and express. I get an error in Browser: TypeError: Cannot read property 'then' of ...
0
votes
1answer
14 views

is it possible to dispatch an action to multiple browsers in redux?

I am new to redux/redux saga and I am trying to develop an app where I have two browsers interacting with each other via redux saga actions. Currently, I am able to dispatch actions within the same ...
0
votes
2answers
27 views

After any request and response, call an api

I need to call api by checking some condition. But this api call is needed after any request / response. But I couldn't find anything useful for this. So, I am looking for a solution to setup the ...
0
votes
0answers
39 views

ES6 generators - Not all breakpoints in Chrome Debugger are available

I'm using redux-saga & generators. It's seems I cannot stop on breakpoint in chrome debugger since they are not available. Setting breakpoints in specific lines make them jump to a different line.....
0
votes
0answers
16 views

How to broadcast message to all clients using WebSockets and Redux-Saga?

I'am trying to communicate all clients with server. The problem is, that when the redux-saga channel is created, it is fired only for one browser window. I checked, that console.log in socket....
0
votes
1answer
16 views

How to start a redux saga watcher using runSaga

I am not able to figure out from the documentation how to start a redux saga watcher using runSaga. Suppose I have the following in saga.js: export function* fetchJokeSaga(action) { try { const ...
1
vote
1answer
23 views

Callback function for this.props.dispatch

I am calling a dispatch function as below this.props .dispatch({ type: LOGIN_REQUESTED, payload: { username, password, }, }) i want to dispatch ...
0
votes
1answer
33 views

How to stop client error with redux saga?

Can't stop infinity loop client error like: https://imgur.com/34BSVu0 This error just typo. But saga action is repeated endless times. When I tried without saga, I got only one time error. (Not ...
1
vote
0answers
22 views

How to manage multi-tab form with React, Redux and Redux saga?

I'm working in a CRM with React, Redux and Redux-Saga. I looking for a nice/scalable way to update and save data with deep data structure maintaining a good UI. Let's assume that I want to edit a ...
1
vote
1answer
34 views

Avoid not needed requests on Saga

I have a redux-saga function bounded to '@@router/LOCATION_CHANGE' action. the main problem is that every time the user switches between sections there are tons of unnecessary requests because the ...
1
vote
0answers
19 views

React-Native: redux-saga: Cannot access static class in selector in release mode

I have a react-native redux saga app, using bluetooth (react-native-ble-plx) and react-navigation. Because I'm not fond of how react-navigation works with the navigation-prop, I extracted the root-...
0
votes
1answer
24 views

How do I execute a method after a successful async action in React and Redux?

I'm trying to execute some code after a successful async action using React Saga. Ideally I would return a Promise to achieve that, but it doesn't seem to be the case. I also tried to use the ...
0
votes
1answer
46 views

Redux saga: How can i make sure only my saga is able to update a certain state?

I have a mobile app made in React Native, and I've just run into a best practice dilemma i've encountered many times while using Redux/Redux Saga. I would love if i could get someone else's thoughts ...
0
votes
1answer
16 views

Result from API call made in saga is null

I have a Redux Saga that calls an API endpoint (GET) via a custom library that returns a promise encompassing a request.getusing the Superagent library. When I make this request in my React app, ...
0
votes
1answer
34 views

Redux actions vs redux-saga actions

I am kind of in dilemma when do we need to use redux actions and redux saga actions. I don't mean to ask when to use redux and when to use redux-saga. But I would like to know that what scenario do ...
1
vote
1answer
38 views

how to use redux-sagas with react-hooks

I would like to know how to use redux sagas with react hooks, how does redux get implemented, is there any unique use cases to know about? Should I be using the regular react dispatch?
1
vote
2answers
38 views

How to test sagas when there are functions not using 'yield' or an effect like 'call' or 'put'?

In all the examples I've found everyone is using yield call(), yield put(), etc. on their sagas. Right now I have a saga that just executes a function without using yield call(). This function is ...
0
votes
0answers
24 views

Communication Between Component and API using Redux- Saga

How can we get the data from the saga directly into our component ? or Is this a pattern we should not follow and directly make a service/ api call from the component using some service layer. ...
0
votes
0answers
31 views

Why after yield all([someGenerator]), another function is not called

I try to call another function after yield all([]) When I replace call() effect with fork(), it works. I know that fork() is no-blocking effect. But assuming that all the effects are resolved (using ...
0
votes
1answer
23 views

Is there a way to strongly type sagas put actions?

In redux-thunk we can define what type of actions can be dispatch enum MoviesTypes { ADD_MOVIES = 'ADD_MOVIES', } interface AddMoviesAction { type: typeof MoviesTypes.ADD_MOVIES; movies: ...
0
votes
0answers
28 views

How to get output of `all` effect?

I am trying to use saga outside the context of redux, simply experimenting with effects and generators. I need to retrieve all key values from Storage in parallel, here is my implementation: export ...
0
votes
2answers
42 views

How to fetch location even when the app is minimised in react-native?

A react native app that tracks location once user allows permmission to the app. The location should be tracked when the app is minimised also and with the location change every 5min a post request to ...
0
votes
1answer
38 views

How to make the same component to act differently depending on the route

I need a high level architecture advice. React, Redux, Redux-Saga is already in use. Endpoints: /api/userData just some data, ignore for now... Then: /api/canView returns [{...}] /api/canEdit ...
0
votes
0answers
24 views

Redux-saga not picking up action dispatch

I am using redux-saga in a new create-react-app react project with redux and for some reason it seems redux-saga is not picking up the dispatched action. A console log statement in the reducer shows ...
0
votes
0answers
15 views

react-final-form throwing ERROR property of undefined

I am trying to migrate my code from react-form to react-final-form. I tried to follow the official doc but got stuck with an error. I am getting "Cannot read property TipForm of undefined" following ...
2
votes
0answers
49 views

Saga is being called multiple times

How to stop saga being called multiple times. Once i dispatched an action i received the result multiple times. i don't know what i'm missing here. Saga.js export function* watchRegisterUser() { ...
0
votes
1answer
29 views

How to get the new state with Redux-Saga?

I'm trying to get the new state to which the getCart() generator function returns me in reducer, but the state is coming "late". The state I need comes only after the second click of the button. ...
0
votes
0answers
51 views

Access React context value from redux-saga function

I have some variables which are controlled by React Context through React.createContext() with Provider and Consumer component. I'm also using redux-saga, so my question is are there anyway to access ...
0
votes
0answers
14 views

Rest API axios error handling in redux-saga using catch

On inspecting in Chrome.In network i get response {"status":"error","data":{"message":"Unauthorized"}} Is there any issue in catching axios error.HOw should i handle this issue. I get succesfull ...
0
votes
1answer
22 views

The next js app does not send response back to browser when I dispatch in getInititalProps

I am learning next js and using next with saga. https://github.com/zeit/next.js/tree/canary/examples/with-redux-saga In other.js file I moved store.dispatch(startClock()) into getInititalProps(). ...
0
votes
1answer
26 views

How to execute an action after the first one is resolved in saga?

I am working on a project that uses React, Redux-Saga. In my code, I have to call same action twice. I want to execute them one after the other. But what happens is that, both of them are called at ...
0
votes
1answer
30 views

I am trying to migrate from redux-Form to react-Final-Form

as previously I was working with reduxForm and then I find out about reactFinalForm. So now I am trying to migrate my code from reduxForm to reactFinalForm with reference with its official docs. but I ...
0
votes
1answer
18 views

Testing Sagas with Jest fails on call, put with major object received differences without a clear explanation

Pardon the verbose title. I am new to Sagas and wrote a basic Saga which, when a button is clicked, fetches something from an API then puts out some more actions. However, I have been unable to test ...
1
vote
0answers
51 views

Is it ok to put business logic into a saga

I'm developing a small react/redux/saga application. It is basically a multistep form with Back and Next buttons, and a progress bar. Each form step (or form screen) has a number of fields. According ...
1
vote
1answer
48 views

Redirect react router with redux-saga

I have redux-saga which should redirect user to main page after successfully logging. I do not use react-router-redux or smth like that so my router is not connected to state. Here is my Login ...
0
votes
2answers
48 views

Adding properties to created Redux Store in Typescript

I'm having issues adding a property when I create a new Redux Store in Typescript: const bindMiddleware = middleware => { if (process.env.NODE_ENV !== 'production') { const { ...
0
votes
1answer
25 views

union type is not working in redux saga action types?

My union type is this BoardsActionType: interface createBoardRequest { type: typeof CREATE_BOARD_REQUEST; payload: { name: string; }; } interface createBoardSuccess { type: typeof ...
0
votes
2answers
30 views

How delay redux saga action to store data update?

Can't delay action firing (initialize from redux-form) to store data update after fetching. Store is initializing with empty account object. At initial render getAccount action firing and triggering ...
0
votes
0answers
16 views

ssr+redux-saga - Actions must be plain objects. Use custom middleware for async actions

I'm working on an application based on ssr+redux-saga. And I have error: "Actions must be plain objects. Use custom middleware for async actions." In the process of research, I came to the conclusion ...
0
votes
1answer
16 views

Dispatching store actions from API methods that are imported in Sagas causes dependency cycles

I have a React application with API methods based on socket.io. File webSocket.js handles Socket connection, as well as basic methods like sending and getting the data, which are used across all of my ...
0
votes
1answer
34 views

How to properly work with redux saga and background event in react native?

I am using react-native, redux-saga, react-native-background-task. First, when my app goes from the foreground to the background (on both IOS and Android), saga continues. I would have expected it to ...
2
votes
2answers
55 views

yielded put action not dispatched to store in callback

Edited code and explanation to make things more clear: I have a saga that calls a (non saga) function that shows an alert to the user. The function (Alerts.showInAppMessage) accepts an onTap ...