{"comment":{"url":"https://api.github.com/repos/teropa/redux-voting-client/comments/13866020","html_url":"https://github.com/teropa/redux-voting-client/commit/84c51e763c662d10e5cd2de8a55554f1b75b40cd#commitcomment-13866020","id":13866020,"user":{"login":"dearfrankg","id":36104,"avatar_url":"https://avatars.githubusercontent.com/u/36104?v=3","gravatar_id":"","url":"https://api.github.com/users/dearfrankg","html_url":"https://github.com/dearfrankg","followers_url":"https://api.github.com/users/dearfrankg/followers","following_url":"https://api.github.com/users/dearfrankg/following{/other_user}","gists_url":"https://api.github.com/users/dearfrankg/gists{/gist_id}","starred_url":"https://api.github.com/users/dearfrankg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dearfrankg/subscriptions","organizations_url":"https://api.github.com/users/dearfrankg/orgs","repos_url":"https://api.github.com/users/dearfrankg/repos","events_url":"https://api.github.com/users/dearfrankg/events{/privacy}","received_events_url":"https://api.github.com/users/dearfrankg/received_events","type":"User","site_admin":false},"position":null,"line":null,"path":"","commit_id":"84c51e763c662d10e5cd2de8a55554f1b75b40cd","created_at":"2015-10-20T06:27:40Z","updated_at":"2015-10-20T06:27:40Z","body":"I modified a bit...\r\n\r\n```js\r\n[...]\r\nfunction resetVote(state, mergedState) {\r\n  const oldPair = state.getIn(['vote', 'pair'], List());\r\n  const newPair = mergedState.getIn(['vote', 'pair'], List());\r\n  if (mergedState.get('hasVoted') && !oldPair.equals(newPair)) {\r\n    return mergedState.remove('hasVoted');\r\n  }\r\n  return mergedState;\r\n}\r\n\r\nexport default function(state = Map(), action) {\r\n  switch (action.type) {\r\n  case 'SET_STATE':\r\n    return resetVote(state, setState(state, action.state));\r\n  case 'VOTE':\r\n    return vote(state, action.voteEntry);\r\n  }\r\n  return state;\r\n}\r\n```"}}