score:1
i am going to answer my question here.
the above code i working, but when i was triggering the actions, i was using redux dev tools to dispatch actions to the store.
i manually dispatched language_start_cycle
using the tools, which changed the state - but apparently this did not notify the saga middle-ware and my channel was never updated:
but when using a simple button in one of my components:
<button onclick={() => dispatch(actions.startcycle())}>
start
</button>
<button onclick={() => dispatch(actions.stopcycle())}>
stop
</button>
the saga middle-ware was notified.
update
my store configuration is:
import { createstore, applymiddleware, compose } from 'redux'
import createsagamiddleware from 'redux-saga';
import rootreducer from '../reducers/index';
import sagas from '../sagas/index';
export default function configurestore(initialstate) {
const sagamiddleware = createsagamiddleware();
const store = createstore(rootreducer, initialstate, compose(
applymiddleware(sagamiddleware),
window.devtoolsextension ? window.devtoolsextension() : f => f
));
if (module.hot) {
// enable webpack hot module replacement for reducers
module.hot.accept('../reducers', () => {
const nextreducer = require('../reducers');
store.replacereducer(nextreducer);
});
}
sagamiddleware.run(sagas);
return store;
}
score:0
i think the wait function is wrong type. you have to fix like this.
const wait = ms => {
return new promise(resolve => {
settimeout(() => resolve(), ms)
})
}
Source: stackoverflow.com
Related Query
- Dispatch action every X second using Redux Saga
- React Redux - How to dispatch an action on componentDidMount when using mapDispatchToProps in a connected component
- Redux action return type when using dispatch and getState
- Wait for redux action to finish dispatching when using redux saga
- How to pass Dispatch to action when using redux form
- Correct way to write in dependency array when dispatch an action using hooks in redux
- How to dispatch action when a state changes in redux toolkit without using useEffect?
- How to dispatch an action just if another action was correctly dispatched ? Using redux thunk (react)
- I am setting a property using setState before dispatching an action, but the property is not set in the redux action on dispatch
- Redux Saga - all the watches called for a dispatch action
- Wait for Redux action to dispatch a second one
- How to dispatch async action in Redux using Redux Thunk: TypeError: Cannot read property 'loading' of undefined
- How to dispatch Redux action from stateless component when route is loaded?
- React Redux dispatch action after another action
- Redux Saga Watch Multiple Action
- How to dispatch an action when clicking on Link when using React-Router & Redux?
- mock useDispatch in jest and test the params with using that dispatch action in functional component
- Redux ToolKit: is it possible to dispatch other actions from the same slice in one action created by createAsyncThunk
- Dispatch a Redux action with the subsequent action as payload to show a snackbar or dialog of Material UI
- Redux Toolkit: Dispatch an action from an extraReducers listener?
- Using shouldComponentUpdate for block component re-render every second
- React Router + Redux - Dispatch an async action on route change?
- How to dispatch redux action outside of a component?
- React redux dispatch action before render container
- How to dispatch an redux action to load data inside useEffect on page load
- What are the benefits of using thunk middleware in redux over using regular functions as async action creators?
- Using React, why is redux saga not intercepting the action?
- Correct way to pass redux saga payload to another action
- How to dispatch multiple action creators (React + Redux + Server-side rendering)
- Redux state doesn't update with action dispatch
More Query from same tag
- (concurrently not found) trying to deploy a PERN app to Heroku
- React-Leaflet, supply position from state
- Access the variable from app class and dynamically hide it
- Trying to get then send a cookie using react and fetch
- How can I have sass variables accessed within a Webpack import?
- What is the problem with router division in express? (React)
- Ajax call returns undefined
- useContext not updating on the same render
- Ant Design Input loses focus on input change
- react split pane shows above other components when using `display: flex`
- html table is duplicating defaultValue's for no apparent reason
- Using leaflet and need to update component. How can I update the values in my constructor?
- Storybook: Addon-Docs Cannot read property 'classes' of undefined
- How to control audio/video DOM element in React
- Share complex React app/component between single-page app, VScode web extension and JupyterLab extension
- Passing react props to a component and displaying
- Typescript Error in React useScroll hook: Cannot invoke an expression whose type lacks a call signature
- react-rails : component does not re-render after record created
- Redux and Token Authentication : how to redirect the user
- Can't reach refs of react component
- React - How to share Child component states with Parent?
- How to combine JSX component with dangerouslySetInnerHTML
- What mean "form submitting canceled"?
- Why does 'yield' throw an error when used twice in saga?
- React-redux, reducer unable to update state,error in code
- Error: animal.image.map is not a function
- JSX - Javascript insertion/Weird Parameters?
- extract value from url using react router
- Typescript nullable keys in object array type declaration
- Formik. Dirty check