{"action":"closed","number":17,"pull_request":{"url":"https://api.github.com/repos/MetaMask/KeyringController/pulls/17","id":185677195,"html_url":"https://github.com/MetaMask/KeyringController/pull/17","diff_url":"https://github.com/MetaMask/KeyringController/pull/17.diff","patch_url":"https://github.com/MetaMask/KeyringController/pull/17.patch","issue_url":"https://api.github.com/repos/MetaMask/KeyringController/issues/17","number":17,"state":"closed","locked":false,"title":"Fix UI being updated before Store","user":{"login":"JonnyBurger","id":1629785,"avatar_url":"https://avatars2.githubusercontent.com/u/1629785?v=4","gravatar_id":"","url":"https://api.github.com/users/JonnyBurger","html_url":"https://github.com/JonnyBurger","followers_url":"https://api.github.com/users/JonnyBurger/followers","following_url":"https://api.github.com/users/JonnyBurger/following{/other_user}","gists_url":"https://api.github.com/users/JonnyBurger/gists{/gist_id}","starred_url":"https://api.github.com/users/JonnyBurger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JonnyBurger/subscriptions","organizations_url":"https://api.github.com/users/JonnyBurger/orgs","repos_url":"https://api.github.com/users/JonnyBurger/repos","events_url":"https://api.github.com/users/JonnyBurger/events{/privacy}","received_events_url":"https://api.github.com/users/JonnyBurger/received_events","type":"User","site_admin":false},"body":"I believe I have found a bug / race condition.\r\n\r\nTake this code for example:\r\n\r\n```\r\n.then(() => {\r\n    this.keyrings.push(keyring)\r\n    return this.persistAllKeyrings()\r\n})\r\n.then(() => this._updateMemStoreKeyrings())\r\n.then(() => this.fullUpdate())\r\n```\r\n\r\nThe intention is to update the MemStore and then emit an update with the newest MemStore. \r\nHowever, due to a bug, the old state is emitted first and then the state is updated.\r\n\r\nLooking at the `_updateMemStoreKeyrings` method, you can see that nothing is returned. That means that it is not an async function and `fullUpdate` does not wait for `_updateMemStoreKeyrings` to finish.\r\n\r\nYou can verify this bug by placing log statements in the callback inside `_updateMemStoreKeyrings` and in  `fullUpdate`. You will see that `fullUpdate` executes first and with the old state.\r\n\r\nI think this did not cause any malfunction in Metamask from what I can tell, but it is a bug nonetheless.","created_at":"2018-05-03T10:42:34Z","updated_at":"2018-05-15T20:59:15Z","closed_at":"2018-05-15T20:59:15Z","merged_at":null,"merge_commit_sha":"bd22e080187dfd5d6dd9ca7adae84199f8e3dd1b","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/MetaMask/KeyringController/pulls/17/commits","review_comments_url":"https://api.github.com/repos/MetaMask/KeyringController/pulls/17/comments","review_comment_url":"https://api.github.com/repos/MetaMask/KeyringController/pulls/comments{/number}","comments_url":"https://api.github.com/repos/MetaMask/KeyringController/issues/17/comments","statuses_url":"https://api.github.com/repos/MetaMask/KeyringController/statuses/1dec98dfd3515fcf96c60ac18f7d8686598c9cd0","head":{"label":"JonnyBurger:async-memstore","ref":"async-memstore","sha":"1dec98dfd3515fcf96c60ac18f7d8686598c9cd0","user":{"login":"JonnyBurger","id":1629785,"avatar_url":"https://avatars2.githubusercontent.com/u/1629785?v=4","gravatar_id":"","url":"https://api.github.com/users/JonnyBurger","html_url":"https://github.com/JonnyBurger","followers_url":"https://api.github.com/users/JonnyBurger/followers","following_url":"https://api.github.com/users/JonnyBurger/following{/other_user}","gists_url":"https://api.github.com/users/JonnyBurger/gists{/gist_id}","starred_url":"https://api.github.com/users/JonnyBurger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JonnyBurger/subscriptions","organizations_url":"https://api.github.com/users/JonnyBurger/orgs","repos_url":"https://api.github.com/users/JonnyBurger/repos","events_url":"https://api.github.com/users/JonnyBurger/events{/privacy}","received_events_url":"https://api.github.com/users/JonnyBurger/received_events","type":"User","site_admin":false},"repo":{"id":131979915,"name":"KeyringController","full_name":"JonnyBurger/KeyringController","owner":{"login":"JonnyBurger","id":1629785,"avatar_url":"https://avatars2.githubusercontent.com/u/1629785?v=4","gravatar_id":"","url":"https://api.github.com/users/JonnyBurger","html_url":"https://github.com/JonnyBurger","followers_url":"https://api.github.com/users/JonnyBurger/followers","following_url":"https://api.github.com/users/JonnyBurger/following{/other_user}","gists_url":"https://api.github.com/users/JonnyBurger/gists{/gist_id}","starred_url":"https://api.github.com/users/JonnyBurger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JonnyBurger/subscriptions","organizations_url":"https://api.github.com/users/JonnyBurger/orgs","repos_url":"https://api.github.com/users/JonnyBurger/repos","events_url":"https://api.github.com/users/JonnyBurger/events{/privacy}","received_events_url":"https://api.github.com/users/JonnyBurger/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/JonnyBurger/KeyringController","description":"A module for managing groups of Ethereum accounts and using them.","fork":true,"url":"https://api.github.com/repos/JonnyBurger/KeyringController","forks_url":"https://api.github.com/repos/JonnyBurger/KeyringController/forks","keys_url":"https://api.github.com/repos/JonnyBurger/KeyringController/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JonnyBurger/KeyringController/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JonnyBurger/KeyringController/teams","hooks_url":"https://api.github.com/repos/JonnyBurger/KeyringController/hooks","issue_events_url":"https://api.github.com/repos/JonnyBurger/KeyringController/issues/events{/number}","events_url":"https://api.github.com/repos/JonnyBurger/KeyringController/events","assignees_url":"https://api.github.com/repos/JonnyBurger/KeyringController/assignees{/user}","branches_url":"https://api.github.com/repos/JonnyBurger/KeyringController/branches{/branch}","tags_url":"https://api.github.com/repos/JonnyBurger/KeyringController/tags","blobs_url":"https://api.github.com/repos/JonnyBurger/KeyringController/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JonnyBurger/KeyringController/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JonnyBurger/KeyringController/git/refs{/sha}","trees_url":"https://api.github.com/repos/JonnyBurger/KeyringController/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JonnyBurger/KeyringController/statuses/{sha}","languages_url":"https://api.github.com/repos/JonnyBurger/KeyringController/languages","stargazers_url":"https://api.github.com/repos/JonnyBurger/KeyringController/stargazers","contributors_url":"https://api.github.com/repos/JonnyBurger/KeyringController/contributors","subscribers_url":"https://api.github.com/repos/JonnyBurger/KeyringController/subscribers","subscription_url":"https://api.github.com/repos/JonnyBurger/KeyringController/subscription","commits_url":"https://api.github.com/repos/JonnyBurger/KeyringController/commits{/sha}","git_commits_url":"https://api.github.com/repos/JonnyBurger/KeyringController/git/commits{/sha}","comments_url":"https://api.github.com/repos/JonnyBurger/KeyringController/comments{/number}","issue_comment_url":"https://api.github.com/repos/JonnyBurger/KeyringController/issues/comments{/number}","contents_url":"https://api.github.com/repos/JonnyBurger/KeyringController/contents/{+path}","compare_url":"https://api.github.com/repos/JonnyBurger/KeyringController/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JonnyBurger/KeyringController/merges","archive_url":"https://api.github.com/repos/JonnyBurger/KeyringController/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JonnyBurger/KeyringController/downloads","issues_url":"https://api.github.com/repos/JonnyBurger/KeyringController/issues{/number}","pulls_url":"https://api.github.com/repos/JonnyBurger/KeyringController/pulls{/number}","milestones_url":"https://api.github.com/repos/JonnyBurger/KeyringController/milestones{/number}","notifications_url":"https://api.github.com/repos/JonnyBurger/KeyringController/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JonnyBurger/KeyringController/labels{/name}","releases_url":"https://api.github.com/repos/JonnyBurger/KeyringController/releases{/id}","deployments_url":"https://api.github.com/repos/JonnyBurger/KeyringController/deployments","created_at":"2018-05-03T10:32:03Z","updated_at":"2018-05-03T10:32:05Z","pushed_at":"2018-05-03T10:38:09Z","git_url":"git://github.com/JonnyBurger/KeyringController.git","ssh_url":"git@github.com:JonnyBurger/KeyringController.git","clone_url":"https://github.com/JonnyBurger/KeyringController.git","svn_url":"https://github.com/JonnyBurger/KeyringController","homepage":"","size":68,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"MetaMask:master","ref":"master","sha":"a038de5c258c59ac1f8d7a7b500b4e6fcbe60bb1","user":{"login":"MetaMask","id":11744586,"avatar_url":"https://avatars2.githubusercontent.com/u/11744586?v=4","gravatar_id":"","url":"https://api.github.com/users/MetaMask","html_url":"https://github.com/MetaMask","followers_url":"https://api.github.com/users/MetaMask/followers","following_url":"https://api.github.com/users/MetaMask/following{/other_user}","gists_url":"https://api.github.com/users/MetaMask/gists{/gist_id}","starred_url":"https://api.github.com/users/MetaMask/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MetaMask/subscriptions","organizations_url":"https://api.github.com/users/MetaMask/orgs","repos_url":"https://api.github.com/users/MetaMask/repos","events_url":"https://api.github.com/users/MetaMask/events{/privacy}","received_events_url":"https://api.github.com/users/MetaMask/received_events","type":"Organization","site_admin":false},"repo":{"id":104502666,"name":"KeyringController","full_name":"MetaMask/KeyringController","owner":{"login":"MetaMask","id":11744586,"avatar_url":"https://avatars2.githubusercontent.com/u/11744586?v=4","gravatar_id":"","url":"https://api.github.com/users/MetaMask","html_url":"https://github.com/MetaMask","followers_url":"https://api.github.com/users/MetaMask/followers","following_url":"https://api.github.com/users/MetaMask/following{/other_user}","gists_url":"https://api.github.com/users/MetaMask/gists{/gist_id}","starred_url":"https://api.github.com/users/MetaMask/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MetaMask/subscriptions","organizations_url":"https://api.github.com/users/MetaMask/orgs","repos_url":"https://api.github.com/users/MetaMask/repos","events_url":"https://api.github.com/users/MetaMask/events{/privacy}","received_events_url":"https://api.github.com/users/MetaMask/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/MetaMask/KeyringController","description":"A module for managing groups of Ethereum accounts and using them.","fork":false,"url":"https://api.github.com/repos/MetaMask/KeyringController","forks_url":"https://api.github.com/repos/MetaMask/KeyringController/forks","keys_url":"https://api.github.com/repos/MetaMask/KeyringController/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MetaMask/KeyringController/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MetaMask/KeyringController/teams","hooks_url":"https://api.github.com/repos/MetaMask/KeyringController/hooks","issue_events_url":"https://api.github.com/repos/MetaMask/KeyringController/issues/events{/number}","events_url":"https://api.github.com/repos/MetaMask/KeyringController/events","assignees_url":"https://api.github.com/repos/MetaMask/KeyringController/assignees{/user}","branches_url":"https://api.github.com/repos/MetaMask/KeyringController/branches{/branch}","tags_url":"https://api.github.com/repos/MetaMask/KeyringController/tags","blobs_url":"https://api.github.com/repos/MetaMask/KeyringController/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MetaMask/KeyringController/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MetaMask/KeyringController/git/refs{/sha}","trees_url":"https://api.github.com/repos/MetaMask/KeyringController/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MetaMask/KeyringController/statuses/{sha}","languages_url":"https://api.github.com/repos/MetaMask/KeyringController/languages","stargazers_url":"https://api.github.com/repos/MetaMask/KeyringController/stargazers","contributors_url":"https://api.github.com/repos/MetaMask/KeyringController/contributors","subscribers_url":"https://api.github.com/repos/MetaMask/KeyringController/subscribers","subscription_url":"https://api.github.com/repos/MetaMask/KeyringController/subscription","commits_url":"https://api.github.com/repos/MetaMask/KeyringController/commits{/sha}","git_commits_url":"https://api.github.com/repos/MetaMask/KeyringController/git/commits{/sha}","comments_url":"https://api.github.com/repos/MetaMask/KeyringController/comments{/number}","issue_comment_url":"https://api.github.com/repos/MetaMask/KeyringController/issues/comments{/number}","contents_url":"https://api.github.com/repos/MetaMask/KeyringController/contents/{+path}","compare_url":"https://api.github.com/repos/MetaMask/KeyringController/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MetaMask/KeyringController/merges","archive_url":"https://api.github.com/repos/MetaMask/KeyringController/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MetaMask/KeyringController/downloads","issues_url":"https://api.github.com/repos/MetaMask/KeyringController/issues{/number}","pulls_url":"https://api.github.com/repos/MetaMask/KeyringController/pulls{/number}","milestones_url":"https://api.github.com/repos/MetaMask/KeyringController/milestones{/number}","notifications_url":"https://api.github.com/repos/MetaMask/KeyringController/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MetaMask/KeyringController/labels{/name}","releases_url":"https://api.github.com/repos/MetaMask/KeyringController/releases{/id}","deployments_url":"https://api.github.com/repos/MetaMask/KeyringController/deployments","created_at":"2017-09-22T17:47:48Z","updated_at":"2018-04-25T16:01:09Z","pushed_at":"2018-05-15T20:58:45Z","git_url":"git://github.com/MetaMask/KeyringController.git","ssh_url":"git@github.com:MetaMask/KeyringController.git","clone_url":"https://github.com/MetaMask/KeyringController.git","svn_url":"https://github.com/MetaMask/KeyringController","homepage":"","size":63,"stargazers_count":7,"watchers_count":7,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"archived":false,"open_issues_count":6,"license":null,"forks":12,"open_issues":6,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/MetaMask/KeyringController/pulls/17"},"html":{"href":"https://github.com/MetaMask/KeyringController/pull/17"},"issue":{"href":"https://api.github.com/repos/MetaMask/KeyringController/issues/17"},"comments":{"href":"https://api.github.com/repos/MetaMask/KeyringController/issues/17/comments"},"review_comments":{"href":"https://api.github.com/repos/MetaMask/KeyringController/pulls/17/comments"},"review_comment":{"href":"https://api.github.com/repos/MetaMask/KeyringController/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/MetaMask/KeyringController/pulls/17/commits"},"statuses":{"href":"https://api.github.com/repos/MetaMask/KeyringController/statuses/1dec98dfd3515fcf96c60ac18f7d8686598c9cd0"}},"author_association":"NONE","merged":false,"mergeable":true,"rebaseable":true,"mergeable_state":"clean","merged_by":null,"comments":1,"review_comments":0,"maintainer_can_modify":false,"commits":1,"additions":1,"deletions":1,"changed_files":1}}
{"actor":{"display_login":"danfinlay"}}