microsoft / redux-dynamic-modules

Modularize Redux by dynamically loading reducers and middlewares.
https://redux-dynamic-modules.js.org
MIT License
1.07k stars 116 forks source link

takexxx saga(saga watched action) in different modules that have been loaded doesn't work in dynamic modules #184

Closed olabala closed 2 years ago

olabala commented 2 years ago

try this demo https://codesandbox.io/s/dynamic-module-e5tf0?file=/src/modules/reducer.js

The use of put should be able to trigger to root add, but in reality it does not, need to use call to make the function work

// yield call(addNumberHandler, addNumber({ count: 1000 }));
yield put(addNumber({ count: 1000 }));
olabala commented 2 years ago

after reading the source code, I think I've got the answer. we don't need to use sagaMiddleWare ourselves, just pass sagas to the module via createStore