Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Sep 19 07:01
    shunmian edited #2218
  • Sep 19 07:00
    shunmian opened #2218
  • Sep 01 22:08

    dependabot[bot] on npm_and_yarn

    (compare)

  • Sep 01 22:08
    dependabot[bot] closed #2210
  • Sep 01 22:08
    dependabot[bot] commented #2210
  • Sep 01 22:08
    changeset-bot[bot] commented #2217
  • Sep 01 22:08

    dependabot[bot] on npm_and_yarn

    Bump tar from 4.4.8 to 4.4.19 … (compare)

  • Sep 01 22:08
    dependabot[bot] labeled #2217
  • Sep 01 22:08
    dependabot[bot] opened #2217
  • Aug 30 14:47
    UniKylin commented #2129
  • Aug 26 15:25
    gmunumel opened #2216
  • Aug 26 12:14
    Andarist commented #2207
  • Aug 26 12:14
    Andarist commented #1592
  • Aug 26 11:35
    madjam002 commented #2207
  • Aug 25 10:27
    springjazzy closed #2147
  • Aug 25 10:26
    springjazzy commented #2147
  • Aug 25 10:25
    springjazzy commented #2147
  • Aug 25 09:04
    springjazzy commented #2147
  • Aug 19 11:36
    hugows commented #78
  • Aug 19 11:35
    hugows commented #78
Tormen Raßmann
@trassmann
you could check the different take implementations
it might make the restrictions of the different channel types more apparent
or just wait till @Andarist chimes in :P
Mateusz Burzyński
@Andarist
if you want standard take(channel) behaviour (unicast) but you want only certain items to be received from it then just do an if statement after take
or dont put unwanted actions on the channel in the first place (not sure if feasible though)
A Flores
@unflores
@chmanie eventChannels use buffers no?
Note: messages on an eventChannel are not buffered by default. You have to provide a buffer to the eventChannel factory in order to specify buffering strategy for the channel (e.g. eventChannel(subscriber, buffer)). See the API docs for more info
Christian Maniewski
@chmanie
@Andarist if I do an if-statement, I basically have to re-implement the matching against strings (types) and patterns. It’s not much but it would be great if I could re-use that
Tormen Raßmann
@trassmann
@chmanie i get the point though, usually you have strict control over what goes into your custom channel no? assuming that, generic matching logic would be overkill
Christian Maniewski
@chmanie
Yeah, I guess you’re right, I probably won’t be needing anything besides string comparisons
Christian Maniewski
@chmanie
I have another question: I’m not entirely sure around the workings of the try-finally construct when using a while(true). How do we get in the finally clause there?
Tormen Raßmann
@trassmann
from w3c: The finally statement lets you execute code, after try and catch, regardless of the result.
i dont understand the question, do you mean why it triggers?
Christian Maniewski
@chmanie
Yeah, what kicks us out of the while(true)
Oh, ok probably an error is thrown
Tormen Raßmann
@trassmann
when any code wrapped in a try block throws an exception the catch/finally will trigger
Christian Maniewski
@chmanie
So take(END) actually throws an error?
Tormen Raßmann
@trassmann
END just kills all takers on the standard channel
so take(END) is kinda redundant
Christian Maniewski
@chmanie
But then it’s caught internally by redux-saga somehow, I guess
Tormen Raßmann
@trassmann
its contradictary actually
A Flores
@unflores
right but to get to finally there has to be an exception thrown right?
Tormen Raßmann
@trassmann

right but to get to finally there has to be an exception thrown right?

yea

Christian Maniewski
@chmanie
Note also we're executing the whole while (true) {...} loop inside a try/finally block. When the interval terminates, the countdown function closes the event channel by invoking emitter(END).
Tormen Raßmann
@trassmann

But then it’s caught internally by redux-saga somehow, I guess

probably you are getting an exception because take(END) is not meant to be done, thats what take.maybe is for

Christian Maniewski
@chmanie
Yeah, I think I was just confused that there’s no error but redux-saga seems to catch that specific one for me
A Flores
@unflores
er nm what am I saying.
This message was deleted
try{ console.log('derp') } catch(err){console.log(err)}finally{console.log('yerp')}
gives 'derp' 'yerp'
so no need for an exception to be thrown
Christian Maniewski
@chmanie
wait, where’s your while(true) @unflores
A Flores
@unflores
I was confused about the usage of finally, no idea how they drop out of while(true) maybe a break somehow?
Christian Maniewski
@chmanie
An exception is needed to break out of this
Tormen Raßmann
@trassmann

so no need for an exception to be thrown

yea it also executes when the try block finishes executing, but it wont in this case since its an endless loop

(unless an exception is thrown)
Christian Maniewski
@chmanie
Can I take the same action multiple times from a channel? It seems the first taker gets it and after that it’s removed from the buffer, is that right?
Christian Maniewski
@chmanie
Yep, FIFO
Another thing. As far as I can see, when I emit an Error in an eventChannel and then take from that channel it should throw, right? This doesn’t really work for me. Meaning it just doesn’t throw it seems
Christian Maniewski
@chmanie
Tests say it shoud 🤔
Christian Maniewski
@chmanie
It does, I’m just doing it wrong it seems
Tormen Raßmann
@trassmann

Can I take the same action multiple times from a channel? It seems the first taker gets it and after that it’s removed from the buffer, is that right?

yea, unless you use multicast channel, then every taker is triggered

Christian Maniewski
@chmanie
:+1:
Oh now all these names make much more sense
Tormen Raßmann
@trassmann
redux saga has an amazing api IMO but it takes some getting used to that way of doing stuff
A Flores
@unflores
Does anyone know where the docs for multicast are? I would like to look them over, https://redux-saga.js.org/docs/introduction/ doesn't have a section that screams multicast at me
Tormen Raßmann
@trassmann
@unflores the docs are a bit behind i'm afraid
image.png