diff --git a/unistore.js b/unistore.js index 9e8fb44..7d9df50 100644 --- a/unistore.js +++ b/unistore.js @@ -116,7 +116,10 @@ function mapActions(actions, store) { for (let i in actions) { mapped[i] = (...args) => { let ret = actions[i](store.getState(), ...args); - if (ret!=null) store.setState(ret); + if (ret!=null) { + if (ret.then) ret.then(store.setState); + else store.setState(ret); + } }; } return mapped;