Skip to content

Commit

Permalink
fix race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
monotkate committed Mar 28, 2018
1 parent 35f0be2 commit d93e01d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/createPersistor.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,12 @@ export default function createPersistor (store, config) {
})

lastState = state
const len = storesToProcess.length

// time iterator (read: debounce)
if (timeIterator === null) {
timeIterator = setInterval(() => {
if (storesToProcess.length === 0) {
if ((paused && len === storesToProcess.length) || storesToProcess.length === 0) {
clearInterval(timeIterator)
timeIterator = null
return
Expand Down

0 comments on commit d93e01d

Please sign in to comment.