{"action":"created","issue":{"url":"https://api.github.com/repos/slorber/scalable-frontend-with-elm-or-redux/issues/12","repository_url":"https://api.github.com/repos/slorber/scalable-frontend-with-elm-or-redux","labels_url":"https://api.github.com/repos/slorber/scalable-frontend-with-elm-or-redux/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/slorber/scalable-frontend-with-elm-or-redux/issues/12/comments","events_url":"https://api.github.com/repos/slorber/scalable-frontend-with-elm-or-redux/issues/12/events","html_url":"https://github.com/slorber/scalable-frontend-with-elm-or-redux/issues/12","id":140476278,"number":12,"title":"Solution feedback: redux-saga-jaysoo","user":{"login":"tomsdev","id":1284597,"avatar_url":"https://avatars.githubusercontent.com/u/1284597?v=3","gravatar_id":"","url":"https://api.github.com/users/tomsdev","html_url":"https://github.com/tomsdev","followers_url":"https://api.github.com/users/tomsdev/followers","following_url":"https://api.github.com/users/tomsdev/following{/other_user}","gists_url":"https://api.github.com/users/tomsdev/gists{/gist_id}","starred_url":"https://api.github.com/users/tomsdev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomsdev/subscriptions","organizations_url":"https://api.github.com/users/tomsdev/orgs","repos_url":"https://api.github.com/users/tomsdev/repos","events_url":"https://api.github.com/users/tomsdev/events{/privacy}","received_events_url":"https://api.github.com/users/tomsdev/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2016-03-13T11:14:14Z","updated_at":"2016-03-15T08:59:42Z","closed_at":null,"body":"Hi, I looked at @jaysoo  [solution](https://github.com/slorber/scalable-frontend-with-elm-or-redux/tree/master/redux-saga-jaysoo) that's using redux-saga and would like to share my main concern:\r\n\r\nEvery component that contains a RandomGif component (for example RandomGifList) duplicates RandomGif actions. **Isn't it possible to reuse RandomGif actions instead of duplicating them?**\r\n\r\nThe consequences of this duplication of actions are visible in:\r\n- RandomGifList/RandomGifPair reducers are almost reimplementing RandomGif reducer, each action one by one.\r\n- RandomGifList/RandomGifPair sagas look very similar to RandomGif saga.\r\n- In main/index.js, in order to react to the NEW_GIF action it needs to subscribe to all its duplicates:\r\n```\r\nyield race(\r\n      [ take(randomGifList.actions.NEW_GIF)\r\n      , take(randomGif.actions.NEW_GIF)\r\n      , take(randomGifPair.actions.NEW_GIF)\r\n      , take(randomGifPairOfPair.actions.NEW_GIF)\r\n      ]\r\n    )\r\n```"},"comment":{"url":"https://api.github.com/repos/slorber/scalable-frontend-with-elm-or-redux/issues/comments/196728667","html_url":"https://github.com/slorber/scalable-frontend-with-elm-or-redux/issues/12#issuecomment-196728667","issue_url":"https://api.github.com/repos/slorber/scalable-frontend-with-elm-or-redux/issues/12","id":196728667,"user":{"login":"tomsdev","id":1284597,"avatar_url":"https://avatars.githubusercontent.com/u/1284597?v=3","gravatar_id":"","url":"https://api.github.com/users/tomsdev","html_url":"https://github.com/tomsdev","followers_url":"https://api.github.com/users/tomsdev/followers","following_url":"https://api.github.com/users/tomsdev/following{/other_user}","gists_url":"https://api.github.com/users/tomsdev/gists{/gist_id}","starred_url":"https://api.github.com/users/tomsdev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomsdev/subscriptions","organizations_url":"https://api.github.com/users/tomsdev/orgs","repos_url":"https://api.github.com/users/tomsdev/repos","events_url":"https://api.github.com/users/tomsdev/events{/privacy}","received_events_url":"https://api.github.com/users/tomsdev/received_events","type":"User","site_admin":false},"created_at":"2016-03-15T08:59:42Z","updated_at":"2016-03-15T08:59:42Z","body":">  If someone wants to extract action type routing into a mini-library I'd be willing to take a look.\r\n\r\nThat's an interesting idea, if I start using this in a project I will extract that part as a library.\r\n\r\n> For a more low-cost solution (assuming we're trying to reduce boilerplate), we can remove most of the sagas from the application. Instead, we'll have a saga to watch for RUN_TASK\r\n\r\nThanks for trying to improve that, it does remove the duplication of sagas but NEW_GIF actions and reducer are still duplicated. It is definitely an interesting approach but the challenge specify:\r\n\r\n> The counter value should be incremented everytime a NEW_GIF action is fired from any NewGif component, no matter the nesting, but the incrementation amount is not fixed.\r\n\r\nHowever, now in your solution the saga increments the counter not in response to a NEW_GIF action that has been dispatched but in response to `randomGif.tasks.fetchRandomGif` which is kind of different.\r\n\r\nI can imagine a NEW_GIF action that wouldn't need fetching because it is already in the cache and then `randomGif.tasks.fetchRandomGif` wouldn't be executed so the saga wouldn't increment the counter.\r\n"}}