score:1

Accepted answer

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:

redux dev tools dispatching

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)  
  })
}

Related Query

More Query from same tag