Closed zhengjunxin closed 7 years ago
In the previous logic, middleware can not know the next state so that it can't add middleware like logger to log the state changes.
provideState({ middleware: [ freactalCxt => Object.assign({}, freactalCxt, { effects: Object.keys(freactalCxt.effects).reduce((memo, key) => { memo[key] = (...args) => { console.log("Effect started", key, args); return freactalCxt.effects[key](...args).then(result => { // result will be [undefined] cause it is call by React's forceUpdate console.log("Effect completed", key); return result; }) }; return memo; }, {}) }) ] })
This looks reasonable. Closes #62.
In the previous logic, middleware can not know the next state so that it can't add middleware like logger to log the state changes.