{"action":"created","comment":{"url":"https://api.github.com/repos/xitu/gold-miner/pulls/comments/83375754","pull_request_review_id":4224115,"id":83375754,"diff_hunk":"@@ -136,21 +131,21 @@ Our app is required to display a list of all products that are out-of-stock. As\n }\n ```\n \n-Sounds like a good idea, right? Well.. it turns out that it isn’t.\n+听起来像个好主意，对吧？ 好吧，事实证明，并不是。\n \n-The reason, like before, is that views are guided by a different set of concerns. Views don’t care about keeping state minimal. If anything, they prefer the complete opposite since data must be laid out for the user’s sake. Different views may present the same state data in different ways and it is usually impossible to satisfy them all without duplicating data.\n+像以前一样，原因是，视图有自己不同的关注点。视图不关心保持状态最小。具体来说，他们的倾向完全相反，因为数据必须为用户布局服务。不同的视图可以以不同的方式呈现相同的状态数据，并且通常不可能在不复制数据的情况下满足它们。\n \n-Which brings us to the next point..\n+这把我们引入到下一个要点。\n \n-### 4. Never hold duplicate data in the app state\n+#### 4. 避免在应用程式状态中保存重复的数据\n \n-A good test whether your state is holding duplicate data is checking if updates must be done to two places at once in order to maintain consistency. In the out-of-stock products example above, suppose that the first product suddenly becomes out-of-stock. In order to process this update, we’ll have to change its _outOfStock_ field in the map to _true_ and add its _ID_ to the array _outOfStockProductIds — _two updates_._\n+测试你的状态是否持有重复数据有一种好办法，就是检查为了保持数据一致性，是否必须同时对两个地方进行更新。在上述缺货产品示例中，假设第一个产品突然变为缺货。 为了处理这个更新，我们必须将其在映射中的 `outOfStock` 字段更改为 true，并将其 ID 添加到数组 `outOfStockProductIds` 之中 - 两个更新。","path":"TODO/avoiding-accidental-complexity-when-structuring-your-app-state.md","position":141,"original_position":141,"commit_id":"14eb2795a43c72a8c8a8af149151d09be6d2d43a","original_commit_id":"14eb2795a43c72a8c8a8af149151d09be6d2d43a","user":{"login":"DeadLion","id":2594907,"avatar_url":"https://avatars.githubusercontent.com/u/2594907?v=3","gravatar_id":"","url":"https://api.github.com/users/DeadLion","html_url":"https://github.com/DeadLion","followers_url":"https://api.github.com/users/DeadLion/followers","following_url":"https://api.github.com/users/DeadLion/following{/other_user}","gists_url":"https://api.github.com/users/DeadLion/gists{/gist_id}","starred_url":"https://api.github.com/users/DeadLion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DeadLion/subscriptions","organizations_url":"https://api.github.com/users/DeadLion/orgs","repos_url":"https://api.github.com/users/DeadLion/repos","events_url":"https://api.github.com/users/DeadLion/events{/privacy}","received_events_url":"https://api.github.com/users/DeadLion/received_events","type":"User","site_admin":false},"body":">，就是检查是否需要同时更新两处数据来保证数据一致性。","created_at":"2016-10-14T08:14:18Z","updated_at":"2016-10-14T08:14:18Z","html_url":"https://github.com/xitu/gold-miner/pull/805#discussion_r83375754","pull_request_url":"https://api.github.com/repos/xitu/gold-miner/pulls/805","_links":{"self":{"href":"https://api.github.com/repos/xitu/gold-miner/pulls/comments/83375754"},"html":{"href":"https://github.com/xitu/gold-miner/pull/805#discussion_r83375754"},"pull_request":{"href":"https://api.github.com/repos/xitu/gold-miner/pulls/805"}}},"pull_request":{"url":"https://api.github.com/repos/xitu/gold-miner/pulls/805","id":89277063,"html_url":"https://github.com/xitu/gold-miner/pull/805","diff_url":"https://github.com/xitu/gold-miner/pull/805.diff","patch_url":"https://github.com/xitu/gold-miner/pull/805.patch","issue_url":"https://api.github.com/repos/xitu/gold-miner/issues/805","number":805,"state":"open","locked":false,"title":"构建应用状态时，你应该避免不必要的复杂性","user":{"login":"chemzqm","id":251450,"avatar_url":"https://avatars.githubusercontent.com/u/251450?v=3","gravatar_id":"","url":"https://api.github.com/users/chemzqm","html_url":"https://github.com/chemzqm","followers_url":"https://api.github.com/users/chemzqm/followers","following_url":"https://api.github.com/users/chemzqm/following{/other_user}","gists_url":"https://api.github.com/users/chemzqm/gists{/gist_id}","starred_url":"https://api.github.com/users/chemzqm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chemzqm/subscriptions","organizations_url":"https://api.github.com/users/chemzqm/orgs","repos_url":"https://api.github.com/users/chemzqm/repos","events_url":"https://api.github.com/users/chemzqm/events{/privacy}","received_events_url":"https://api.github.com/users/chemzqm/received_events","type":"User","site_admin":false},"body":"翻译完成","created_at":"2016-10-13T20:33:28Z","updated_at":"2016-10-14T08:14:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"468d647e059f73dea805963b3caa80fab64738fa","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/xitu/gold-miner/pulls/805/commits","review_comments_url":"https://api.github.com/repos/xitu/gold-miner/pulls/805/comments","review_comment_url":"https://api.github.com/repos/xitu/gold-miner/pulls/comments{/number}","comments_url":"https://api.github.com/repos/xitu/gold-miner/issues/805/comments","statuses_url":"https://api.github.com/repos/xitu/gold-miner/statuses/14eb2795a43c72a8c8a8af149151d09be6d2d43a","head":{"label":"chemzqm:patch-1","ref":"patch-1","sha":"14eb2795a43c72a8c8a8af149151d09be6d2d43a","user":{"login":"chemzqm","id":251450,"avatar_url":"https://avatars.githubusercontent.com/u/251450?v=3","gravatar_id":"","url":"https://api.github.com/users/chemzqm","html_url":"https://github.com/chemzqm","followers_url":"https://api.github.com/users/chemzqm/followers","following_url":"https://api.github.com/users/chemzqm/following{/other_user}","gists_url":"https://api.github.com/users/chemzqm/gists{/gist_id}","starred_url":"https://api.github.com/users/chemzqm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chemzqm/subscriptions","organizations_url":"https://api.github.com/users/chemzqm/orgs","repos_url":"https://api.github.com/users/chemzqm/repos","events_url":"https://api.github.com/users/chemzqm/events{/privacy}","received_events_url":"https://api.github.com/users/chemzqm/received_events","type":"User","site_admin":false},"repo":{"id":48603892,"name":"gold-miner","full_name":"chemzqm/gold-miner","owner":{"login":"chemzqm","id":251450,"avatar_url":"https://avatars.githubusercontent.com/u/251450?v=3","gravatar_id":"","url":"https://api.github.com/users/chemzqm","html_url":"https://github.com/chemzqm","followers_url":"https://api.github.com/users/chemzqm/followers","following_url":"https://api.github.com/users/chemzqm/following{/other_user}","gists_url":"https://api.github.com/users/chemzqm/gists{/gist_id}","starred_url":"https://api.github.com/users/chemzqm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chemzqm/subscriptions","organizations_url":"https://api.github.com/users/chemzqm/orgs","repos_url":"https://api.github.com/users/chemzqm/repos","events_url":"https://api.github.com/users/chemzqm/events{/privacy}","received_events_url":"https://api.github.com/users/chemzqm/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/chemzqm/gold-miner","description":"掘金翻译计划，翻译掘金上优质的英文文章","fork":true,"url":"https://api.github.com/repos/chemzqm/gold-miner","forks_url":"https://api.github.com/repos/chemzqm/gold-miner/forks","keys_url":"https://api.github.com/repos/chemzqm/gold-miner/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chemzqm/gold-miner/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chemzqm/gold-miner/teams","hooks_url":"https://api.github.com/repos/chemzqm/gold-miner/hooks","issue_events_url":"https://api.github.com/repos/chemzqm/gold-miner/issues/events{/number}","events_url":"https://api.github.com/repos/chemzqm/gold-miner/events","assignees_url":"https://api.github.com/repos/chemzqm/gold-miner/assignees{/user}","branches_url":"https://api.github.com/repos/chemzqm/gold-miner/branches{/branch}","tags_url":"https://api.github.com/repos/chemzqm/gold-miner/tags","blobs_url":"https://api.github.com/repos/chemzqm/gold-miner/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chemzqm/gold-miner/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chemzqm/gold-miner/git/refs{/sha}","trees_url":"https://api.github.com/repos/chemzqm/gold-miner/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chemzqm/gold-miner/statuses/{sha}","languages_url":"https://api.github.com/repos/chemzqm/gold-miner/languages","stargazers_url":"https://api.github.com/repos/chemzqm/gold-miner/stargazers","contributors_url":"https://api.github.com/repos/chemzqm/gold-miner/contributors","subscribers_url":"https://api.github.com/repos/chemzqm/gold-miner/subscribers","subscription_url":"https://api.github.com/repos/chemzqm/gold-miner/subscription","commits_url":"https://api.github.com/repos/chemzqm/gold-miner/commits{/sha}","git_commits_url":"https://api.github.com/repos/chemzqm/gold-miner/git/commits{/sha}","comments_url":"https://api.github.com/repos/chemzqm/gold-miner/comments{/number}","issue_comment_url":"https://api.github.com/repos/chemzqm/gold-miner/issues/comments{/number}","contents_url":"https://api.github.com/repos/chemzqm/gold-miner/contents/{+path}","compare_url":"https://api.github.com/repos/chemzqm/gold-miner/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chemzqm/gold-miner/merges","archive_url":"https://api.github.com/repos/chemzqm/gold-miner/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chemzqm/gold-miner/downloads","issues_url":"https://api.github.com/repos/chemzqm/gold-miner/issues{/number}","pulls_url":"https://api.github.com/repos/chemzqm/gold-miner/pulls{/number}","milestones_url":"https://api.github.com/repos/chemzqm/gold-miner/milestones{/number}","notifications_url":"https://api.github.com/repos/chemzqm/gold-miner/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chemzqm/gold-miner/labels{/name}","releases_url":"https://api.github.com/repos/chemzqm/gold-miner/releases{/id}","deployments_url":"https://api.github.com/repos/chemzqm/gold-miner/deployments","created_at":"2015-12-26T08:03:18Z","updated_at":"2016-10-14T05:41:46Z","pushed_at":"2016-10-14T07:43:42Z","git_url":"git://github.com/chemzqm/gold-miner.git","ssh_url":"git@github.com:chemzqm/gold-miner.git","clone_url":"https://github.com/chemzqm/gold-miner.git","svn_url":"https://github.com/chemzqm/gold-miner","homepage":"http://gold.xitu.io","size":15588,"stargazers_count":0,"watchers_count":0,"language":null,"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":"xitu:master","ref":"master","sha":"f28c0b679ead83aa2c410413766192e87b5ecfac","user":{"login":"xitu","id":10482599,"avatar_url":"https://avatars.githubusercontent.com/u/10482599?v=3","gravatar_id":"","url":"https://api.github.com/users/xitu","html_url":"https://github.com/xitu","followers_url":"https://api.github.com/users/xitu/followers","following_url":"https://api.github.com/users/xitu/following{/other_user}","gists_url":"https://api.github.com/users/xitu/gists{/gist_id}","starred_url":"https://api.github.com/users/xitu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xitu/subscriptions","organizations_url":"https://api.github.com/users/xitu/orgs","repos_url":"https://api.github.com/users/xitu/repos","events_url":"https://api.github.com/users/xitu/events{/privacy}","received_events_url":"https://api.github.com/users/xitu/received_events","type":"Organization","site_admin":false},"repo":{"id":45512989,"name":"gold-miner","full_name":"xitu/gold-miner","owner":{"login":"xitu","id":10482599,"avatar_url":"https://avatars.githubusercontent.com/u/10482599?v=3","gravatar_id":"","url":"https://api.github.com/users/xitu","html_url":"https://github.com/xitu","followers_url":"https://api.github.com/users/xitu/followers","following_url":"https://api.github.com/users/xitu/following{/other_user}","gists_url":"https://api.github.com/users/xitu/gists{/gist_id}","starred_url":"https://api.github.com/users/xitu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xitu/subscriptions","organizations_url":"https://api.github.com/users/xitu/orgs","repos_url":"https://api.github.com/users/xitu/repos","events_url":"https://api.github.com/users/xitu/events{/privacy}","received_events_url":"https://api.github.com/users/xitu/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/xitu/gold-miner","description":"掘金翻译计划，翻译掘金上优质的英文文章","fork":false,"url":"https://api.github.com/repos/xitu/gold-miner","forks_url":"https://api.github.com/repos/xitu/gold-miner/forks","keys_url":"https://api.github.com/repos/xitu/gold-miner/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xitu/gold-miner/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xitu/gold-miner/teams","hooks_url":"https://api.github.com/repos/xitu/gold-miner/hooks","issue_events_url":"https://api.github.com/repos/xitu/gold-miner/issues/events{/number}","events_url":"https://api.github.com/repos/xitu/gold-miner/events","assignees_url":"https://api.github.com/repos/xitu/gold-miner/assignees{/user}","branches_url":"https://api.github.com/repos/xitu/gold-miner/branches{/branch}","tags_url":"https://api.github.com/repos/xitu/gold-miner/tags","blobs_url":"https://api.github.com/repos/xitu/gold-miner/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xitu/gold-miner/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xitu/gold-miner/git/refs{/sha}","trees_url":"https://api.github.com/repos/xitu/gold-miner/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xitu/gold-miner/statuses/{sha}","languages_url":"https://api.github.com/repos/xitu/gold-miner/languages","stargazers_url":"https://api.github.com/repos/xitu/gold-miner/stargazers","contributors_url":"https://api.github.com/repos/xitu/gold-miner/contributors","subscribers_url":"https://api.github.com/repos/xitu/gold-miner/subscribers","subscription_url":"https://api.github.com/repos/xitu/gold-miner/subscription","commits_url":"https://api.github.com/repos/xitu/gold-miner/commits{/sha}","git_commits_url":"https://api.github.com/repos/xitu/gold-miner/git/commits{/sha}","comments_url":"https://api.github.com/repos/xitu/gold-miner/comments{/number}","issue_comment_url":"https://api.github.com/repos/xitu/gold-miner/issues/comments{/number}","contents_url":"https://api.github.com/repos/xitu/gold-miner/contents/{+path}","compare_url":"https://api.github.com/repos/xitu/gold-miner/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xitu/gold-miner/merges","archive_url":"https://api.github.com/repos/xitu/gold-miner/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xitu/gold-miner/downloads","issues_url":"https://api.github.com/repos/xitu/gold-miner/issues{/number}","pulls_url":"https://api.github.com/repos/xitu/gold-miner/pulls{/number}","milestones_url":"https://api.github.com/repos/xitu/gold-miner/milestones{/number}","notifications_url":"https://api.github.com/repos/xitu/gold-miner/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xitu/gold-miner/labels{/name}","releases_url":"https://api.github.com/repos/xitu/gold-miner/releases{/id}","deployments_url":"https://api.github.com/repos/xitu/gold-miner/deployments","created_at":"2015-11-04T03:29:13Z","updated_at":"2016-10-14T07:59:38Z","pushed_at":"2016-10-14T07:43:43Z","git_url":"git://github.com/xitu/gold-miner.git","ssh_url":"git@github.com:xitu/gold-miner.git","clone_url":"https://github.com/xitu/gold-miner.git","svn_url":"https://github.com/xitu/gold-miner","homepage":"http://gold.xitu.io","size":16344,"stargazers_count":4253,"watchers_count":4253,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":770,"mirror_url":null,"open_issues_count":17,"forks":770,"open_issues":17,"watchers":4253,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/xitu/gold-miner/pulls/805"},"html":{"href":"https://github.com/xitu/gold-miner/pull/805"},"issue":{"href":"https://api.github.com/repos/xitu/gold-miner/issues/805"},"comments":{"href":"https://api.github.com/repos/xitu/gold-miner/issues/805/comments"},"review_comments":{"href":"https://api.github.com/repos/xitu/gold-miner/pulls/805/comments"},"review_comment":{"href":"https://api.github.com/repos/xitu/gold-miner/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/xitu/gold-miner/pulls/805/commits"},"statuses":{"href":"https://api.github.com/repos/xitu/gold-miner/statuses/14eb2795a43c72a8c8a8af149151d09be6d2d43a"}}}}
{"actor":{"display_login":"DeadLion"}}