title: How I deal with multiple actions calling different functions in redux saga?
body: <p>Here an example which is going to be easier to understand.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function* a() {
   yield takeEvery(action.LOGIN_SUCCESS, b)
  }
  
  function* b() {
    yield takeEvery(action.FETCH_SUCCESS, c)
  }
  
  function* c() {
    yield console.log('action from function a')
  
  }
  
  function* d() {
  yield takeEvery(action.FETCH_SUCCESS, e)
  
  }
  
  function* e() {
    yield console.log('action from function d')
  }
  
  
  
  yield all([
    fork(a),
    fork(d),
  ])</code></pre>
  </div>
  </div>
  </p>
  
  <p>If LOGIN_SUCCESS happens then function b starts waiting for FETCH_SUCCESS.
  At the same time, function d is waiting for FETCH_SUCCESS.</p>
  
  <p>The question is: how can I stop function d from running after the takeEvery in function a takes the LOGIN_SUCCESS and then FETCH_SUCCESS action?</p>
  
  <p>In this case I want only function c to be called. Instead, what happens is that both function c and function e are called because FETCH_SUCCESS happens.</p>
  
  <p>The idea is that I would like to have something in redux saga which remembers the previous action taken by the previous generator so that I can distinguish two different paths:</p>
  
  <p><code>1) LOGIN_SUCCESS -&gt; FETCH_SUCCESS -&gt; function c</code></p>
  
  <p><code>2) FETCH_SUCCESS -&gt; function e</code></p>
  
  <p>Hope I have been clear enough :)</p>