Skip to content

Commit ba88051

Browse files
committed
Fix bug where error is thrown if flux.reset() is called before unwatch fn
1 parent 0847a3a commit ba88051

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/reactor/fns.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,13 @@ exports.removeObserverByEntry = function(observerState, entry) {
246246
map.update('any', anyObsevers => anyObsevers.remove(id))
247247
} else {
248248
storeDeps.forEach(storeId => {
249-
map.updateIn(['stores', storeId], observers => observers.remove(id))
249+
map.updateIn(['stores', storeId], observers => {
250+
if (observers) {
251+
// check for observers being present because reactor.reset() can be called before an unwatch fn
252+
return observers.remove(id)
253+
}
254+
return observers
255+
})
250256
})
251257
}
252258

0 commit comments

Comments
 (0)