Hacker News new | ask | show | jobs
by mhink 3294 days ago
> After the codebase was converted, the team generally concurred that sagas were a waste of time and effort, especially with async/await gaining steam.

To be fair, I'd almost certainly recommend async/await for simpler use cases- in particular, an application in which API calls are the only async behavior. However, in our situation, redux-saga turned out to work pretty well. We needed to coordinate some relatively complex UI flows (the user would draw on a map, then the app would POST the coords to the server). Before introducing redux-saga, we were starting to get lost in a daisy-chain of Redux actions.

> Reasoning about what code runs next is easy, until it's not.

This was the general idea behind "navigationSaga"- to set things up so there's as little as possible happening at a given time.

> The claims that testability is improved do not ring true to me. Some of those tests were just awful to write and maintain.

I dunno. On one hand, I wish there were better tools for testing sagas, but on the other, testing long chains of Promises has caused me all kinds of headaches in the past, as well. I find that it's easier for me to keep responsibilities separate when using sagas than it is using promises or suchlike.

And for what it's worth, I'm not trying to bill sagas as a be-all-end-all solution for all life's problems. :) I was just trying to sorta explicate an approach that worked for us.

1 comments

It sounds like you guys made the right moves - trying promises first until that fell apart, and then carefully picking a new path forward.

My comment was mainly intended as a "cautionary tale" for those folks who get really excited about the latest and greatest, and don't apply that base level of skepticism to new tech.