{"action":"created","issue":{"url":"https://api.github.com/repos/rackt/redux/issues/524","labels_url":"https://api.github.com/repos/rackt/redux/issues/524/labels{/name}","comments_url":"https://api.github.com/repos/rackt/redux/issues/524/comments","events_url":"https://api.github.com/repos/rackt/redux/issues/524/events","html_url":"https://github.com/rackt/redux/issues/524","id":101132565,"number":524,"title":"Error in count of TodoMVC example","user":{"login":"imjared","id":525011,"avatar_url":"https://avatars.githubusercontent.com/u/525011?v=3","gravatar_id":"","url":"https://api.github.com/users/imjared","html_url":"https://github.com/imjared","followers_url":"https://api.github.com/users/imjared/followers","following_url":"https://api.github.com/users/imjared/following{/other_user}","gists_url":"https://api.github.com/users/imjared/gists{/gist_id}","starred_url":"https://api.github.com/users/imjared/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imjared/subscriptions","organizations_url":"https://api.github.com/users/imjared/orgs","repos_url":"https://api.github.com/users/imjared/repos","events_url":"https://api.github.com/users/imjared/events{/privacy}","received_events_url":"https://api.github.com/users/imjared/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-15T02:33:59Z","updated_at":"2015-08-15T06:00:43Z","closed_at":null,"body":"I'd love to send a PR for this one since I'm just getting my feet wet but it might take me a bit so I'll defer to people smarter :)\r\n\r\nTo reproduce:\r\n1. Load TodoMVC example\r\n2. Add a few items to your todo list. Note that the counter properly increments (mine is at 4)\r\n3. Mark one item as complete. Note that the counter properly decrements (mine is at 3)\r\n4. Toggle the view to show only completed tasks. Note the counter still correctly shows the number of items left on your list. (mine is at 3)\r\n5. Click \"clear completed.\" You should still have the correct number of items displaying. (mine is at 3)\r\n6. Go back to the \"all\" view. Add a new item to the list.\r\n\r\nExpected result:\r\n1. The list should grow in length with the item I just added at the top. The counter of \"items left\" should increment by one\r\n\r\nActual result\r\n1. My item is added to the top but the last item on the list disappears. The counter of \"items left\" has incremented by one but only three items are visible. ![image](https://cloud.githubusercontent.com/assets/525011/9287112/15902fa0-42d4-11e5-8f2b-48c006de3689.png)\r\n2. Adding new items after this will grow the list as expected but the Todo that disappeared will remain gone. The counter of \"items left\" still accounts for the missing Todo.\r\n\r\nThere's some additional funk on the counter that occurs if you remove an item from the list while it's in this incremented state. I can file more of a bug report if needed but I have a hunch that resolving this problem will resolve the latter issue."},"comment":{"url":"https://api.github.com/repos/rackt/redux/issues/comments/131305488","html_url":"https://github.com/rackt/redux/issues/524#issuecomment-131305488","issue_url":"https://api.github.com/repos/rackt/redux/issues/524","id":131305488,"user":{"login":"salehe","id":1437198,"avatar_url":"https://avatars.githubusercontent.com/u/1437198?v=3","gravatar_id":"","url":"https://api.github.com/users/salehe","html_url":"https://github.com/salehe","followers_url":"https://api.github.com/users/salehe/followers","following_url":"https://api.github.com/users/salehe/following{/other_user}","gists_url":"https://api.github.com/users/salehe/gists{/gist_id}","starred_url":"https://api.github.com/users/salehe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/salehe/subscriptions","organizations_url":"https://api.github.com/users/salehe/orgs","repos_url":"https://api.github.com/users/salehe/repos","events_url":"https://api.github.com/users/salehe/events{/privacy}","received_events_url":"https://api.github.com/users/salehe/received_events","type":"User","site_admin":false},"created_at":"2015-08-15T06:00:43Z","updated_at":"2015-08-15T06:00:43Z","body":"This is happening because the newly added task has the same `id` as the previous task. This is because the `todos` reducer is simply assigning `state.length` as `id` when a new task is added.\r\n\r\nI think the solution is to keep some increment-only part (like `nextId`) in the state or just use big UUIDs."}}