{"action":"created","comment":{"url":"https://api.github.com/repos/gaearon/redux/pulls/comments/32722046","id":32722046,"diff_hunk":"@@ -0,0 +1,49 @@\n+import { ADD_TODO, DELETE_TODO, EDIT_TODO, MARK_TODO, MARK_ALL } from '../constants/ActionTypes';\n+\n+const initialState = [{\n+  text: 'do something',\n+  marked: false,\n+  id: 0\n+}];\n+\n+export default function todos(state = initialState, action) {\n+  switch (action.type) {\n+    case ADD_TODO:\n+      return [{\n+        id: (state.length === 0 ? 0 : state[0].id) + 1,\n+        marked: false,\n+        text: action.text\n+      }, ...state];\n+    case DELETE_TODO:\n+      return state.filter(todo => todo.id !== action.id);\n+    case EDIT_TODO:\n+      return state.map(todo => {\n+        if (todo.id === action.id) {\n+          todo.text = action.text;\n+        }\n+        return todo;\n+      });\n+    case MARK_TODO:\n+      return state.map(todo => {\n+        if (todo.id === action.id) {\n+          todo.marked = !todo.marked;\n+        }\n+        return todo;\n+      });\n+    case MARK_ALL: {\n+      if (state.filter(todo => todo.marked).length < state.length) {\n+        return state.map(todo => {\n+          todo.marked = true;","path":"examples/todomvc/stores/todos.js","position":36,"original_position":36,"commit_id":"989f72d7435da57e4a758cb14026d0de81c40895","original_commit_id":"989f72d7435da57e4a758cb14026d0de81c40895","user":{"login":"gaearon","id":810438,"avatar_url":"https://avatars.githubusercontent.com/u/810438?v=3","gravatar_id":"","url":"https://api.github.com/users/gaearon","html_url":"https://github.com/gaearon","followers_url":"https://api.github.com/users/gaearon/followers","following_url":"https://api.github.com/users/gaearon/following{/other_user}","gists_url":"https://api.github.com/users/gaearon/gists{/gist_id}","starred_url":"https://api.github.com/users/gaearon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gaearon/subscriptions","organizations_url":"https://api.github.com/users/gaearon/orgs","repos_url":"https://api.github.com/users/gaearon/repos","events_url":"https://api.github.com/users/gaearon/events{/privacy}","received_events_url":"https://api.github.com/users/gaearon/received_events","type":"User","site_admin":false},"body":"This is mutation. Please avoid mutations. Write `todo => { ...todo, marked: true }` instead.","created_at":"2015-06-18T11:57:43Z","updated_at":"2015-06-18T11:57:43Z","html_url":"https://github.com/gaearon/redux/pull/105#discussion_r32722046","pull_request_url":"https://api.github.com/repos/gaearon/redux/pulls/105","_links":{"self":{"href":"https://api.github.com/repos/gaearon/redux/pulls/comments/32722046"},"html":{"href":"https://github.com/gaearon/redux/pull/105#discussion_r32722046"},"pull_request":{"href":"https://api.github.com/repos/gaearon/redux/pulls/105"}}},"pull_request":{"url":"https://api.github.com/repos/gaearon/redux/pulls/105","id":37795258,"html_url":"https://github.com/gaearon/redux/pull/105","diff_url":"https://github.com/gaearon/redux/pull/105.diff","patch_url":"https://github.com/gaearon/redux/pull/105.patch","issue_url":"https://api.github.com/repos/gaearon/redux/issues/105","number":105,"state":"open","locked":false,"title":"[WIP] Todo MVC ","user":{"login":"vramana","id":3112509,"avatar_url":"https://avatars.githubusercontent.com/u/3112509?v=3","gravatar_id":"","url":"https://api.github.com/users/vramana","html_url":"https://github.com/vramana","followers_url":"https://api.github.com/users/vramana/followers","following_url":"https://api.github.com/users/vramana/following{/other_user}","gists_url":"https://api.github.com/users/vramana/gists{/gist_id}","starred_url":"https://api.github.com/users/vramana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vramana/subscriptions","organizations_url":"https://api.github.com/users/vramana/orgs","repos_url":"https://api.github.com/users/vramana/repos","events_url":"https://api.github.com/users/vramana/events{/privacy}","received_events_url":"https://api.github.com/users/vramana/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-06-16T13:36:35Z","updated_at":"2015-06-18T11:57:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6270518eadda553cfae1199e919be0d0221cdf8a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/gaearon/redux/pulls/105/commits","review_comments_url":"https://api.github.com/repos/gaearon/redux/pulls/105/comments","review_comment_url":"https://api.github.com/repos/gaearon/redux/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gaearon/redux/issues/105/comments","statuses_url":"https://api.github.com/repos/gaearon/redux/statuses/989f72d7435da57e4a758cb14026d0de81c40895","head":{"label":"vramana:todo-delete","ref":"todo-delete","sha":"989f72d7435da57e4a758cb14026d0de81c40895","user":{"login":"vramana","id":3112509,"avatar_url":"https://avatars.githubusercontent.com/u/3112509?v=3","gravatar_id":"","url":"https://api.github.com/users/vramana","html_url":"https://github.com/vramana","followers_url":"https://api.github.com/users/vramana/followers","following_url":"https://api.github.com/users/vramana/following{/other_user}","gists_url":"https://api.github.com/users/vramana/gists{/gist_id}","starred_url":"https://api.github.com/users/vramana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vramana/subscriptions","organizations_url":"https://api.github.com/users/vramana/orgs","repos_url":"https://api.github.com/users/vramana/repos","events_url":"https://api.github.com/users/vramana/events{/privacy}","received_events_url":"https://api.github.com/users/vramana/received_events","type":"User","site_admin":false},"repo":{"id":37479663,"name":"redux","full_name":"vramana/redux","owner":{"login":"vramana","id":3112509,"avatar_url":"https://avatars.githubusercontent.com/u/3112509?v=3","gravatar_id":"","url":"https://api.github.com/users/vramana","html_url":"https://github.com/vramana","followers_url":"https://api.github.com/users/vramana/followers","following_url":"https://api.github.com/users/vramana/following{/other_user}","gists_url":"https://api.github.com/users/vramana/gists{/gist_id}","starred_url":"https://api.github.com/users/vramana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vramana/subscriptions","organizations_url":"https://api.github.com/users/vramana/orgs","repos_url":"https://api.github.com/users/vramana/repos","events_url":"https://api.github.com/users/vramana/events{/privacy}","received_events_url":"https://api.github.com/users/vramana/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vramana/redux","description":"An experiment in fully hot-reloadable Flux","fork":true,"url":"https://api.github.com/repos/vramana/redux","forks_url":"https://api.github.com/repos/vramana/redux/forks","keys_url":"https://api.github.com/repos/vramana/redux/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vramana/redux/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vramana/redux/teams","hooks_url":"https://api.github.com/repos/vramana/redux/hooks","issue_events_url":"https://api.github.com/repos/vramana/redux/issues/events{/number}","events_url":"https://api.github.com/repos/vramana/redux/events","assignees_url":"https://api.github.com/repos/vramana/redux/assignees{/user}","branches_url":"https://api.github.com/repos/vramana/redux/branches{/branch}","tags_url":"https://api.github.com/repos/vramana/redux/tags","blobs_url":"https://api.github.com/repos/vramana/redux/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vramana/redux/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vramana/redux/git/refs{/sha}","trees_url":"https://api.github.com/repos/vramana/redux/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vramana/redux/statuses/{sha}","languages_url":"https://api.github.com/repos/vramana/redux/languages","stargazers_url":"https://api.github.com/repos/vramana/redux/stargazers","contributors_url":"https://api.github.com/repos/vramana/redux/contributors","subscribers_url":"https://api.github.com/repos/vramana/redux/subscribers","subscription_url":"https://api.github.com/repos/vramana/redux/subscription","commits_url":"https://api.github.com/repos/vramana/redux/commits{/sha}","git_commits_url":"https://api.github.com/repos/vramana/redux/git/commits{/sha}","comments_url":"https://api.github.com/repos/vramana/redux/comments{/number}","issue_comment_url":"https://api.github.com/repos/vramana/redux/issues/comments{/number}","contents_url":"https://api.github.com/repos/vramana/redux/contents/{+path}","compare_url":"https://api.github.com/repos/vramana/redux/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vramana/redux/merges","archive_url":"https://api.github.com/repos/vramana/redux/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vramana/redux/downloads","issues_url":"https://api.github.com/repos/vramana/redux/issues{/number}","pulls_url":"https://api.github.com/repos/vramana/redux/pulls{/number}","milestones_url":"https://api.github.com/repos/vramana/redux/milestones{/number}","notifications_url":"https://api.github.com/repos/vramana/redux/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vramana/redux/labels{/name}","releases_url":"https://api.github.com/repos/vramana/redux/releases{/id}","created_at":"2015-06-15T17:20:23Z","updated_at":"2015-06-15T17:20:24Z","pushed_at":"2015-06-18T10:38:02Z","git_url":"git://github.com/vramana/redux.git","ssh_url":"git@github.com:vramana/redux.git","clone_url":"https://github.com/vramana/redux.git","svn_url":"https://github.com/vramana/redux","homepage":"","size":270,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"gaearon:master","ref":"master","sha":"fc5621a7261f766bf33f160b0d813f882ab50543","user":{"login":"gaearon","id":810438,"avatar_url":"https://avatars.githubusercontent.com/u/810438?v=3","gravatar_id":"","url":"https://api.github.com/users/gaearon","html_url":"https://github.com/gaearon","followers_url":"https://api.github.com/users/gaearon/followers","following_url":"https://api.github.com/users/gaearon/following{/other_user}","gists_url":"https://api.github.com/users/gaearon/gists{/gist_id}","starred_url":"https://api.github.com/users/gaearon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gaearon/subscriptions","organizations_url":"https://api.github.com/users/gaearon/orgs","repos_url":"https://api.github.com/users/gaearon/repos","events_url":"https://api.github.com/users/gaearon/events{/privacy}","received_events_url":"https://api.github.com/users/gaearon/received_events","type":"User","site_admin":false},"repo":{"id":36535156,"name":"redux","full_name":"gaearon/redux","owner":{"login":"gaearon","id":810438,"avatar_url":"https://avatars.githubusercontent.com/u/810438?v=3","gravatar_id":"","url":"https://api.github.com/users/gaearon","html_url":"https://github.com/gaearon","followers_url":"https://api.github.com/users/gaearon/followers","following_url":"https://api.github.com/users/gaearon/following{/other_user}","gists_url":"https://api.github.com/users/gaearon/gists{/gist_id}","starred_url":"https://api.github.com/users/gaearon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gaearon/subscriptions","organizations_url":"https://api.github.com/users/gaearon/orgs","repos_url":"https://api.github.com/users/gaearon/repos","events_url":"https://api.github.com/users/gaearon/events{/privacy}","received_events_url":"https://api.github.com/users/gaearon/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gaearon/redux","description":"Atomic Flux with hot reloading","fork":false,"url":"https://api.github.com/repos/gaearon/redux","forks_url":"https://api.github.com/repos/gaearon/redux/forks","keys_url":"https://api.github.com/repos/gaearon/redux/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gaearon/redux/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gaearon/redux/teams","hooks_url":"https://api.github.com/repos/gaearon/redux/hooks","issue_events_url":"https://api.github.com/repos/gaearon/redux/issues/events{/number}","events_url":"https://api.github.com/repos/gaearon/redux/events","assignees_url":"https://api.github.com/repos/gaearon/redux/assignees{/user}","branches_url":"https://api.github.com/repos/gaearon/redux/branches{/branch}","tags_url":"https://api.github.com/repos/gaearon/redux/tags","blobs_url":"https://api.github.com/repos/gaearon/redux/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gaearon/redux/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gaearon/redux/git/refs{/sha}","trees_url":"https://api.github.com/repos/gaearon/redux/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gaearon/redux/statuses/{sha}","languages_url":"https://api.github.com/repos/gaearon/redux/languages","stargazers_url":"https://api.github.com/repos/gaearon/redux/stargazers","contributors_url":"https://api.github.com/repos/gaearon/redux/contributors","subscribers_url":"https://api.github.com/repos/gaearon/redux/subscribers","subscription_url":"https://api.github.com/repos/gaearon/redux/subscription","commits_url":"https://api.github.com/repos/gaearon/redux/commits{/sha}","git_commits_url":"https://api.github.com/repos/gaearon/redux/git/commits{/sha}","comments_url":"https://api.github.com/repos/gaearon/redux/comments{/number}","issue_comment_url":"https://api.github.com/repos/gaearon/redux/issues/comments{/number}","contents_url":"https://api.github.com/repos/gaearon/redux/contents/{+path}","compare_url":"https://api.github.com/repos/gaearon/redux/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gaearon/redux/merges","archive_url":"https://api.github.com/repos/gaearon/redux/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gaearon/redux/downloads","issues_url":"https://api.github.com/repos/gaearon/redux/issues{/number}","pulls_url":"https://api.github.com/repos/gaearon/redux/pulls{/number}","milestones_url":"https://api.github.com/repos/gaearon/redux/milestones{/number}","notifications_url":"https://api.github.com/repos/gaearon/redux/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gaearon/redux/labels{/name}","releases_url":"https://api.github.com/repos/gaearon/redux/releases{/id}","created_at":"2015-05-29T23:53:15Z","updated_at":"2015-06-18T11:42:07Z","pushed_at":"2015-06-18T10:38:02Z","git_url":"git://github.com/gaearon/redux.git","ssh_url":"git@github.com:gaearon/redux.git","clone_url":"https://github.com/gaearon/redux.git","svn_url":"https://github.com/gaearon/redux","homepage":"https://medium.com/@dan_abramov/the-evolution-of-flux-frameworks-6c16ad26bb31","size":1916,"stargazers_count":515,"watchers_count":515,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":35,"mirror_url":null,"open_issues_count":22,"forks":35,"open_issues":22,"watchers":515,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gaearon/redux/pulls/105"},"html":{"href":"https://github.com/gaearon/redux/pull/105"},"issue":{"href":"https://api.github.com/repos/gaearon/redux/issues/105"},"comments":{"href":"https://api.github.com/repos/gaearon/redux/issues/105/comments"},"review_comments":{"href":"https://api.github.com/repos/gaearon/redux/pulls/105/comments"},"review_comment":{"href":"https://api.github.com/repos/gaearon/redux/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gaearon/redux/pulls/105/commits"},"statuses":{"href":"https://api.github.com/repos/gaearon/redux/statuses/989f72d7435da57e4a758cb14026d0de81c40895"}}}}