salsita / prism

React / Redux action composition made simple http://salsita.github.io/prism/
495 stars 24 forks source link

Can no longer use put in certain sagas #45

Closed tomkis closed 8 years ago

tomkis commented 8 years ago

This is a fix for #44

The problem was that subscription to output Saga stream was made after Saga instantiation, however in redux-saga version - Saga may potentially dispatch (yield put...) action in the initialisation phase:

eg:

function* saga() {
  yield put({ type: 'SomeAction' });
}

This action is dispatched right upon Saga instantiation and therefore Saga repository has not been yet subscribed to Saga output stream and therefore the action is ignored.

The fix is easy: we just need to subscribe to output action stream inside the constructor of the Saga.

matthewgertner commented 8 years ago

LGTM