diff --git a/withSubscribe.js b/withSubscribe.js index 47b0d3d..a45aa0a 100644 --- a/withSubscribe.js +++ b/withSubscribe.js @@ -1,7 +1,7 @@ module.exports = createStore => (reducer,...args) => { const listeners = [] const wrapped = (state, action) => ( - action && action.type != '@@init' && setTimeout(() => listeners.forEach(listener => listener()), 0), + action && action.type != '@@init' && window.requestAnimationFrame(() => listeners.forEach(listener => listener())), reducer(state, action) ) const store = createStore(wrapped, ...args)