redux-saga / redux-saga

An alternative side effect model for Redux apps

Home Page:https://redux-saga.js.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

yield take() ignores actions put() in the same saga?

jchook opened this issue · comments

Description

I would expect this saga to create an infinite loop, putting and taking the same action over and over. However, it does not. Actions put() from the same while-loop are invisible to take().

function* minimalSaga(): any {
  while (true) {
    const action = yield take()
    console.log(action)
    yield put(action)
  }
}

Is this by design? Is it a bug?

Here is a full repro.

Related Issues:

I think I see why now -- to capture an action, yield take() must be blocking while yield put() is called.