Replies: 7 comments 15 replies
-
Hi @neurosnap! I am the author of the issue #2151. That's why I was notified that the issue was closed. Let me try to give my very personal opinion on redux-saga after having used it at a large clients project with like 8-10 JS developers. what don't you like?The default coupling with redux is not really useful anymore in 2022. A message listener and a dispatcher without any state management would be enough for the lib. Another point I heard from colleagues was the Get some docs right: things like what do you want to see changed?Call redux-saga what it is: a process manager. Even the author of this lib stated that it's not the correct term: https://survivejs.com/blog/redux-saga-interview/#sagas what is stopping you from using this library in your next project?The coupling of Redux and the slow progress in development in this lib, which makes me think that newly discovered bugs will be solved in years or never. Another reason: I never need the power of the lib. You can manage most side effects with async/await and call it a day. If you really need to store a state of a process (like for a user onboarding) you might just use a state machine to store the name of the state or use eventsourcing to store and recreate a state from you data. The only reason to use redux-saga :) |
Beta Was this translation helpful? Give feedback.
-
I worked on Tableau Prep for about 4 years and we got a ton of mileage out of Redux Saga. While we usually used call and put effects, we definitely used some of the others (
|
Beta Was this translation helpful? Give feedback.
-
I had an experience with hefty code base too, and can relate to this comment. But I'd like to also add:
|
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
One of the first GH issues for this project DevTools for Sagas is still relevant to us today. Improving callstacks or providing a devtools that could make it easier to debug errors that happen within sagas would be really beneficial. I know that since it is one of the original issues for this project, it probably won't be easy. |
Beta Was this translation helpful? Give feedback.
-
I'm pretty new to this, but how does |
Beta Was this translation helpful? Give feedback.
-
One of the most common question I see when people use sagas is ~"how do I return some data back to react when dispatching an action" (usually fetched data). Of course, the primary way is modifying the redux store but that has multiple issues: The other option is some form of a callback. This is also not ideal because sagas by themselves don't guarantee that the action is going to be handled or that it is going to be handled just once. + Now again you have non-serializable function in your actions. Now, I know there is another issue here about a The idea is to keep your usual effects as they are and have an useSaga hook in addition that would E.g. function * mySaga(reactEffects) {
yield reactEffects.take('FETCH_DATA')
const token = yield select(reduxState => reduxState.token)
const result = yield fetch('/foo', token )
reactEffects.put({type: 'RESULT', payload: result})
}
const Component = () => {
const [state, dispatch] = useSaga(mySaga, reducer, initialState);
return <button onClick={() => dispatch({type: 'FETCH_DATA'}) />
} I've tried to have a stab at this few years back, but struggled a lot with how unpredictable react is with calling the the reducer function and bail outs so it never fully worked + I never got my head around the saga internals so I used standard saga effects instead, which of course wouldn't work for official implementation. |
Beta Was this translation helpful? Give feedback.
-
Hey all!
I'd like to compile a community list of features that are missing in redux-saga in 2022.
I still use redux-saga in all my work and personal projects. I think long-running tasks work extremely well on the front-end. Coupling that with complex flow control and you can handle pretty much any business logic using redux-saga.
Having said that, with the addition of libraries like react-query, rtk-query, remix, and jotai people are seeing less utility in using redux-saga especially when considering the upfront cost of learning it's flow control model using generators.
I have ideas on how to bring redux-saga back into the zeitgeist of front end engineers but I want to read from you as well.
Some probing questions:
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions