redux-saga

Test code coverage javascript es6 generators (redux-saga / istanbul.js)

痞子三分冷 提交于 2021-01-27 14:33:05
问题 Working with redux-saga, I wrote some tests. I tried to generate code coverage using istanbul.js. It works fine for most of the code but the result for the sagas is broken: seems like random information. Anyone knows how to solve this ? 回答1: I personally use Jest, which includes code coverage and it seems to work fine with my sagas. I also wrote a test utility to help testing sagas (redux-saga-testing), and in the repo, you'll find examples of tests written with Jest, Mocha and AVA. Both Jest

Should I run all saga when launch app?

六眼飞鱼酱① 提交于 2021-01-27 12:52:26
问题 I've just started to learn and use redux-saga, at first I thought it worked this way: first you make action which is connected to saga, then saga detects action,calls api which returns data and saga returns this data to reducer. I built 2 testing saga files and one root saga (I wanted to make rootSaga, like combineReducer), so this is my rootSaga : import * as SpreadsheetSagas from "../pages/spreadsheet/containers/spreadsheet/spreadsheet.saga"; import * as SpreadsheetFilterSagas from "..

Do not fail whole task even if one of promises rejected

旧巷老猫 提交于 2020-12-30 08:17:05
问题 In redux saga if we want to handle multiple promises, we can use all (which is equivalent of Promise.all ): yield all( users.map((user) => call(signUser, user)), ); function* signUser() { yield call(someApi); yield put(someSuccessAction); } The problem is , even if one of the promises (calls) fail, the whole task is cancelled. My goal is to keep the task alive , even if one of the promises failed. In pure JS I could handle it with Promise.allSettled , but whats the proper way to do it in

redux-logger not showing action names suddenly only “object, object”

寵の児 提交于 2020-12-15 05:41:29
问题 I learn react and try to get Redux to work so I use the Redux-logger. When dispatching two actions from App.js it works as the top image show "ALBUME_DATA_LOADED". Then I make a dispatch from from another place and get this output: I'm not sure I sent that "object, object" action I place breakpoint and console log and it's strange the react-logger it catching an action that I dont think I sent.. Any idea? Here is the action types I use in the below code as userActionTypes : File user.types.js

How to reset filter values in react admin framework?

≡放荡痞女 提交于 2020-12-08 06:52:06
问题 I have a filter component: export const PostsFilter = (props) => ( <Filter {...props}> <TextInput label='Post ID' source='id' alwaysOn /> <TextInput label='User ID' source='user_id' alwaysOn /> </Filter> ); I need to add a reset button that will clear input values. I understand that in should be done via dispatching smth to redux. So maybe somebody already solved this problem? Thanks! 回答1: There is a setFilters prop in your filter component, you can use it: export const PostsFilter = (props)