diff --git a/index.js b/index.js index 74a6a9b..de29079 100644 --- a/index.js +++ b/index.js @@ -160,7 +160,7 @@ function dispatcher (hooks) { _state = wrapHook(_state, initialStateWraps) } - if (!opts.noSubscriptions) subsCalled = true + if (opts.subscriptions !== false) subsCalled = true if (!opts.noReducers) reducersCalled = true if (!opts.noEffects) effectsCalled = true if (!opts.noState) stateCalled = true diff --git a/test.js b/test.js index fecdeb2..87fb5a6 100644 --- a/test.js +++ b/test.js @@ -137,6 +137,17 @@ tape('api: createSend = store.start(opts)', (t) => { const subscriptions = Object.keys(store._subscriptions) t.deepEqual(subscriptions.length, 0, 'no subscriptions registered') }) + + t.test('opts.subscriptions = true should register subs after initial call with subs disabled', + (t) => { + t.plan(1) + const store = barracks() + store.model({ subscriptions: { foo: noop } }) + store.start({ subscriptions: false }) + store.start() + const subscriptions = Object.keys(store._subscriptions) + t.deepEqual(subscriptions.length, 1, 'subscriptions registered') + }) }) tape('api: state = store.state()', (t) => {