Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 07:48
    voliva commented #1504
  • 04:39
    dcz-ii commented #1120
  • Aug 22 16:21
    carneiror commented #1504
  • Aug 22 16:15
    carneiror commented #1504
  • Aug 22 15:52
    carneiror commented #1504
  • Aug 22 15:52
    carneiror commented #1504
  • Aug 22 15:51
    carneiror commented #1504
  • Aug 22 15:35
    lukescott commented #1504
  • Aug 22 15:33
    lukescott commented #1504
  • Aug 22 15:31
    lukescott commented #1504
  • Aug 22 15:31
    lukescott commented #1504
  • Aug 22 15:31
    lukescott commented #1504
  • Aug 22 15:30
    lukescott commented #1504
  • Aug 22 14:19
    henrikra commented #1504
  • Aug 22 14:00
    carneiror commented #1504
  • Aug 22 14:00
    carneiror commented #1504
  • Aug 22 06:05
    henrikra commented #1504
  • Aug 21 22:12
    lukescott commented #1504
  • Aug 21 16:03
    tlaitinen closed #1914
  • Aug 21 16:03
    tlaitinen commented #1914
A Flores
@unflores
Ah ok. Cool. Honestly I wanted to look at it to have a few ideas about what the usage would be. I'm not very creative :)
I tried digging through the code recently and I was a little lost.
Tormen Raßmann
@trassmann
i asked about it in december here
image.png
A Flores
@unflores
I assume it gives you the possiblity to treat sagas as a message broker. I have a hard time arriving at a good use case, but like I said, creativity problems :)
ah, cool. thanks for the info
g. nicholas d'andrea
@gnidan
hey folks... does anyone happen to have a resource that describes the lifecycle of an action in the context of put/take? I'm having a hard time reasoning about put vs. putResolve, e.g., so more generally, I'm hoping to find a collection of sequence diagrams or something like that
Tim De Groote
@timdegroote
Hey everyone, small question: Does redux-saga always run its effects synchronously? Or does it sometimes wait to execute its effects. The reason why I'm askin is because I have a case where two actions are called (ACTION1 and ACTION2). ACTION1 is dispatched first and ACTION2 shortly after. Now I need a saga to respond to ACTION1 before ACTION2 hits the reducer but from my console it looks like the saga is triggered when both ACTION1 and ACTION2 are already handled by the reducer.
Amir Off
@amiroffme

Hello everyon,

I need help with this redux-saga/redux-saga#1762

Tormen Raßmann
@trassmann
@ameer157 your problem seems trivial but your description is lacking, please explain your issue more clearly
Amir Off
@amiroffme

@trassmann I have a delete acition that calls a confirmation modal that can reject or accept the call. Let's say I clicked delete like five times then clicked no and sixth time clicked yes on the confirmation modal: the generator function calls the API for a delete request (six HTTP requests) - I checked in the network tab in chrome dev tools). It seems to that when clicking "No" the confirmation modal doesn't actually reject the call of the delete generator function.

Danke sehr! :)))

Matt Foxx
@FoxxMD
What's the difference between all and join when using an array of tasks (created from fork)?
ah nevermind, all is for effects and join is for tasks
but it looks like they do the same thing, essentially
A Flores
@unflores
what is the difference between a task and an effect? I found the def of an effect: https://redux-saga.js.org/docs/basics/DeclarativeEffects.html essentially a json obj that will be run by the middleware.
Are you calling the generator functions tasks?
Ah nm, that is what it is
Rishi Kumar Chawda
@rishichawda
Hi @all, I'm having trouble deciding how to handle global errors on my sagas and I was unable to find an elegant solution to it. Currently all my sagas have a huge try block which sends errors to sentry in its catch block if there's any error. Can someone please suggest me any better solution for this? I even followed up a few issues on the GitHub repo and stackoverflow but unfortunately I couldn't find something I can say can be considered as best practice. So I wanted to know how everyone else handles this. Any help, advice or suggestion is appreciated! Thanks in advance and I hope everyone is having a nice day!
A Flores
@unflores
This doesn't surprise me, the nature of saga calls makes me think more of error catching on an individual basis. If you are hitting an api, then you'll have to deal with 400 etc. That type of thing should probably be dealt with on a case by case basis. If you are looking for a global catch-all, I found this in github: redux-saga/redux-saga#1672
It might correspond to your needs @rishichawda
Rishi Kumar Chawda
@rishichawda
@unflores I am aware of that issue and solution given there, but as you can see that makes the root saga terminate. Which I don't want. I want to handle the errors and restart / rollback etc if anything like that happens.
Rishi Kumar Chawda
@rishichawda
Also, I'm using apisauce for calls to my api server so everything in the requests part is handled very well right now. What I wanted to do is make sure I handle possible scenarios that might happen in the production which cannot be reproduced so well manually. Like what if there's an inconsistent state or what if the data is corrupted or what if something happens on put or call. I need to handle those errors too. I'm not concerned about anything breaking in the UI since I'm having error boundaries for them but I need to make sure everything works fine with sagas too. Right now I pretty much have one try catch block in every saga which kind of feels redundant and doesn't look pretty to me. So I was looking for an elegant way to do that.
How do you handle errors in your saga btw? @unflores
A Flores
@unflores
@rishichawda we catch them in individual sagas. For me that makes the most sense, anything that gets up to the mainSaga error handler is more of a "catastrophic" error, I don't want to handle it b/c I wasn't expecting it. I just want to log it somewhere so I can deal with it later. I treat it as equivilant to a 500 from an api.
Evan Meeks
@evanmeeks
@rishichawda apisauce NICE!
@rishichawda I've been looking for something solid like this
Rishi Kumar Chawda
@rishichawda
@evanmeeks glad you found it useful. it is my go to solution for setting up things quick!
msaraac
@msaraac
Hello guys how can I get cookie with in the reducer
Chris LeBlanc
@spacesuitdiver
Hello, I'm having trouble understanding how/when to use fork/all... when registering "rootSagas"... I'm using redux-saga-requests and my sagas are broken into redux "duck" like modules, any duck may fire redux saga requests.
What I'm currently facing though I think is unrelated... for some reason my takeLatest from one module is not responding to another's action fired I think
in my rootSaga I have yield createRequestInstance(); yield watchRequests(); all([fork(duck1), fork(duck2)]);
Chris LeBlanc
@spacesuitdiver
I guess to make a digestible question, what's the relationship between something that is forked and takeLatest?
Tormen Raßmann
@trassmann
takeLatest takes the action from the standard channel and forks a new task, if the same action is fired again while an old task is still running it gets cancelled AFAIK
and a forked task is just a forked task
you need to yield the all effect as well though
yield all([fork(duck1), fork(duck2)]);
Mladen Petrović
@mladenp
Hey all, i am getting error call: argument of type {context, fn} has undefined or null while trying to compose sagas.
I have no idea whats wrong
Monteiro Steed
@SteedMonteiro

Hello @everyone

We’re looking for React/React Native engineers to work as part of our community. We have multiple projects and missions, where you choose on what you want to work. There is no hiring process, so keep your resumate... it’s an open organisation, here only our work matter :)

StudioLabs is a 100% remote international company, originally founded in Paris, France. We help companies develop their applications by providing them skills of developers and designers from around the world. We believe in living a life of freedom, where freelancers can choose their missions.

Join our community here:http://bit.ly/2w2BHYO

rwong
@foodforarabbit
@rishichawda hey I hope this reply isn't too late, but you can have sagas call each other in a chain, so you can consolidate all your generic error handling in one place. For example, instead of takeEvery(GET_RESOURCE_ACTION, getResources) and have getResources call the api directly, you can have getResources handle composing parameters / handling api response. In the middle, getResources might yield call callAndHandleApiErrors which deals with figuring out which api-specific things you need like headers, endpoints, etc... and dealing with api-level response errors. And within callAndHandleApiErrors you might have yet another saga that does the actual fetch call itself, and handles network-level issues. For example, if you want to auto-retry an api call X amount of times, you might pass that as a parameter down to the fetch* saga which can handle retrying your api call, and if it fails X times then it can dispatch an error and return something to the callAndHandleApiErrors saga so that it knows that it can proceed (e.g. just return null or something).
vitalicwow
@vitalicwow
Using redux-saga-test-plan, any idea why my generator that returns a Promise would cause test to time out? Getting error: "Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout."
3kgoldie
@3kgoldie
Can someone explain how the saga middleware works under the hood? Like I understand how middlewares work and I understand what take/takeEvery ect does, but I don't understand how the saga middleware does its job of getting the actions to the right sagas. Or maybe point me to a resource that explains it?
Ahmad R
@harvester-klirk
hi guys , how do i pass an argument from the action creator to my saga ?
AmyBlankenship
@AmyBlankenship
In the documentation on task cancellation (https://redux-saga.js.org/docs/advanced/TaskCancellation.html), it shows how to test that a task was cancelled, but it seems to me to be waaay more important to test that the code in the task that actually does the real cancellation (if yield(cancelled) {abortController.abort()} for example) runs. But I haven't been able to figure out how you create a generator as a task and cancel it so that I can test this. I think I understand how to spy on the constructor for AbortController so I can look at what happened--I just have no clue how to make it happen in a test scenario. The code would normally get cancelled by takeLatest.
@harvester-klirk , if you're asking what I think you're asking, the action itself will be the argument, and you'll look at its properties to determine what you should do. In addition, you can get access to the state using select() to fill in any gaps.
AmyBlankenship
@AmyBlankenship
For anyone else wanting to test the finally logic in a canceled saga, I found the answer here https://stackoverflow.com/questions/46166401/unit-testing-redux-saga-task-cancellation https://github.com/redux-saga/redux-saga/issues/266#issuecomment-216087030. Hope this helps someone
Matti Järvinen
@nemeciii_twitter
Kinda related to @AmyBlankenship ´s question. I'm testing a full saga with runSaga. How would I add another action in there so I can test that it cancels the previous one?
Alan.He
@alanhg
for v1.o, catch not work? const rootTask = sagaMiddleware.run(rootSaga)
rootTask.done.catch(...)
Alan.He
@alanhg
Alan.He
@alanhg
anybody know the issue