question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can I make yield take(chan, ‘SOME_ACTION’) working?

See original GitHub issue

Hello everyone!

We use redux-saga extensively and love this great and superb library 😃 We utilize a lot of channels to communicate between many sagas and write code like this:

yield take(chan, ‘SOME_ACTION’).

At first we thought that take effect is able to handle invocation with two arguments channel and pattern because:

function runTakeEffect({channel, pattern, maybe}, cb)

But this is partly true. It’s works if channel was empty when we yielded take effect. In this case taker was pushed into takers array and it will be called with accordance to matching pattern when action is put into channel. But if the buffer is not empty then taker is invoked immediately with first element from buffer ignoring pattern at all. How can we workaround this problem and get only certain actions from the channel using yield take(chan, ‘SOME_ACTION’)? @yelouafi How do you think about including such behavior into the lib? Maybe iterate over buffer to return action that is matched to pattern?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Andaristcommented, Jun 24, 2020

What is the difference between stdChannel and multicastChannel?

It’s almost the same, stdChannel has slightly different scheduling - it is only supposed to be used as ‘top-level’ channel with runSaga API.

0reactions
hbarceloscommented, Jun 24, 2020

Hey @Andarist, sorry for the delay… Busy week at work.j

I couldn’t find much about multicastChannel around. What is the difference between stdChannel and multicastChannel?

Read more comments on GitHub >

github_iconTop Results From Across the Web

API Reference - Redux-Saga
The result of yield take(pattern) is an action object being dispatched. If it is a function, the action is matched if pattern(action) is...
Read more >
The power of Redux-Saga - Medium
This means that the saga will not continue to run to the next yield until the API call finishes. Once it's finished, we...
Read more >
How to yield inside an external callback function in react redux ...
What I'm trying to do is to yield an action and do something else, but I see that I can't use yield inside...
Read more >
API Reference | redux-saga-ie8
The rest corresponds to the following arguments (You can use args.join(' ') to concatenate all args into a single StringS ). Example. Below...
Read more >
Reinforcement Learning: An Introduction - Stanford University
could be made in the computational study of reinforcement learning until it ... strongly recommend working the exercises provided throughout the book. So-....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found