{"action":"created","comment":{"url":"https://api.github.com/repos/sprintly/sprintly-ui/pulls/comments/27497832","id":27497832,"diff_hunk":"@@ -128,23 +126,30 @@ var SelectorMenu = React.createClass({\n       return;\n     }\n \n-    var visible = _.map(fuzzy.filter(filterBy, this.state.visible), function(result) {\n-      return result.string;\n-    });\n+    var visible = _.pluck(fuzzy.filter(filterBy, this.getOptionNames()), 'string');\n \n     this.setState({\n       visible: visible\n     });\n   },\n \n+  componentWillReceiveProps: function(nextProps) {\n+    if (nextProps.optionsList.length !== this.props.optionsList.length) {\n+      this.setState({ visible: [] });\n+    }\n+  },\n+\n   render: function() {\n     var wrapperClass = this.state.expanded ? 'selector__wrapper expanded' : 'selector__wrapper';\n     var innerClass = this.state.expanded ? 'inner-wrapper expanded' : 'inner-wrapper';\n+    var visible = this.state.visible.length > 0 ? this.state.visible : this.getOptionNames();\n+    var selected = this.state.selected && this.props.defaultSelection === undefined ?","path":"src/components/selector_menu/index.js","position":50,"original_position":50,"commit_id":"e220df39cf645ec8b439e8e0380f930b2ed26bc5","original_commit_id":"e220df39cf645ec8b439e8e0380f930b2ed26bc5","user":{"login":"wookiehangover","id":84644,"avatar_url":"https://avatars.githubusercontent.com/u/84644?v=3","gravatar_id":"","url":"https://api.github.com/users/wookiehangover","html_url":"https://github.com/wookiehangover","followers_url":"https://api.github.com/users/wookiehangover/followers","following_url":"https://api.github.com/users/wookiehangover/following{/other_user}","gists_url":"https://api.github.com/users/wookiehangover/gists{/gist_id}","starred_url":"https://api.github.com/users/wookiehangover/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wookiehangover/subscriptions","organizations_url":"https://api.github.com/users/wookiehangover/orgs","repos_url":"https://api.github.com/users/wookiehangover/repos","events_url":"https://api.github.com/users/wookiehangover/events{/privacy}","received_events_url":"https://api.github.com/users/wookiehangover/received_events","type":"User","site_admin":false},"body":"So ideally I'd like this to behave like a controlled component... Because the problem with having `this.state.selected` always control the value is that when an external change happens (like in the filters UI, where the filters are controlled in 2 different places) it gets stuck in the wrong state. \r\n\r\nMaybe the correct thing to do is follow the convention of react form inputs and have separate `defaultValue` and `value` props. In our case, `defaultSelection` would behave the same, supplying an initial value that's then entirely controlled with internally-tracked state (making it an \"uncontrolled\" component).\r\n\r\nWe would also expose a `value` (or `selection` to match the convention of the other name) that would take precedence over any internal state, so this can be used as a \"controlled\" component.\r\n\r\n@florapdx lmk if you want to hangout on this today","created_at":"2015-03-31T16:47:20Z","updated_at":"2015-03-31T16:47:20Z","html_url":"https://github.com/sprintly/sprintly-ui/pull/12#discussion_r27497832","pull_request_url":"https://api.github.com/repos/sprintly/sprintly-ui/pulls/12","_links":{"self":{"href":"https://api.github.com/repos/sprintly/sprintly-ui/pulls/comments/27497832"},"html":{"href":"https://github.com/sprintly/sprintly-ui/pull/12#discussion_r27497832"},"pull_request":{"href":"https://api.github.com/repos/sprintly/sprintly-ui/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/sprintly/sprintly-ui/pulls/12","id":32280520,"html_url":"https://github.com/sprintly/sprintly-ui/pull/12","diff_url":"https://github.com/sprintly/sprintly-ui/pull/12.diff","patch_url":"https://github.com/sprintly/sprintly-ui/pull/12.patch","issue_url":"https://api.github.com/repos/sprintly/sprintly-ui/issues/12","number":12,"state":"open","locked":false,"title":"Fix Selector Props","user":{"login":"wookiehangover","id":84644,"avatar_url":"https://avatars.githubusercontent.com/u/84644?v=3","gravatar_id":"","url":"https://api.github.com/users/wookiehangover","html_url":"https://github.com/wookiehangover","followers_url":"https://api.github.com/users/wookiehangover/followers","following_url":"https://api.github.com/users/wookiehangover/following{/other_user}","gists_url":"https://api.github.com/users/wookiehangover/gists{/gist_id}","starred_url":"https://api.github.com/users/wookiehangover/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wookiehangover/subscriptions","organizations_url":"https://api.github.com/users/wookiehangover/orgs","repos_url":"https://api.github.com/users/wookiehangover/repos","events_url":"https://api.github.com/users/wookiehangover/events{/privacy}","received_events_url":"https://api.github.com/users/wookiehangover/received_events","type":"User","site_admin":false},"body":"#### What does it do?\r\nFixes a bug where the SelectorMenu would retain the props first passed to it. This was happening because props were being copied over to state.\r\n\r\nTo fix it, we have to first check that props aren't copied over to state and that the selected state gets reset when new options are received. This makes it possible to control the component when the data driving it changes. \r\n\r\n### Where should the reviewer start?\r\nsrc/components/selector_menu/index.js\r\n\r\n#### How should it be manually tested?\r\nThe example in the test suite shows how props can change from the outside, but the best way to see this in action is to `npm link` it to sprintly/5columns and notice that the members dropdown filters change as you switch between products.\r\n\r\n#### Definition of done:\r\n- [x] Is this appropriately tested?\r\n- [x] Does this need an update to the README or documentation?\r\n- [x] Does this need an update to the examples?\r\n- [x] Does this add new dependencies?\r\n- [x] Does this require a semver version bump?\r\n  - [-] MAJOR\r\n  - [-] MINOR\r\n  - [x] PATCH","created_at":"2015-03-31T00:17:33Z","updated_at":"2015-03-31T16:47:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"75ffa24ced4f9f641e99b9d17683ebdc5ba31ae2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/sprintly/sprintly-ui/pulls/12/commits","review_comments_url":"https://api.github.com/repos/sprintly/sprintly-ui/pulls/12/comments","review_comment_url":"https://api.github.com/repos/sprintly/sprintly-ui/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sprintly/sprintly-ui/issues/12/comments","statuses_url":"https://api.github.com/repos/sprintly/sprintly-ui/statuses/e220df39cf645ec8b439e8e0380f930b2ed26bc5","head":{"label":"sprintly:fix-selector-props","ref":"fix-selector-props","sha":"e220df39cf645ec8b439e8e0380f930b2ed26bc5","user":{"login":"sprintly","id":387934,"avatar_url":"https://avatars.githubusercontent.com/u/387934?v=3","gravatar_id":"","url":"https://api.github.com/users/sprintly","html_url":"https://github.com/sprintly","followers_url":"https://api.github.com/users/sprintly/followers","following_url":"https://api.github.com/users/sprintly/following{/other_user}","gists_url":"https://api.github.com/users/sprintly/gists{/gist_id}","starred_url":"https://api.github.com/users/sprintly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sprintly/subscriptions","organizations_url":"https://api.github.com/users/sprintly/orgs","repos_url":"https://api.github.com/users/sprintly/repos","events_url":"https://api.github.com/users/sprintly/events{/privacy}","received_events_url":"https://api.github.com/users/sprintly/received_events","type":"Organization","site_admin":false},"repo":{"id":25992114,"name":"sprintly-ui","full_name":"sprintly/sprintly-ui","owner":{"login":"sprintly","id":387934,"avatar_url":"https://avatars.githubusercontent.com/u/387934?v=3","gravatar_id":"","url":"https://api.github.com/users/sprintly","html_url":"https://github.com/sprintly","followers_url":"https://api.github.com/users/sprintly/followers","following_url":"https://api.github.com/users/sprintly/following{/other_user}","gists_url":"https://api.github.com/users/sprintly/gists{/gist_id}","starred_url":"https://api.github.com/users/sprintly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sprintly/subscriptions","organizations_url":"https://api.github.com/users/sprintly/orgs","repos_url":"https://api.github.com/users/sprintly/repos","events_url":"https://api.github.com/users/sprintly/events{/privacy}","received_events_url":"https://api.github.com/users/sprintly/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sprintly/sprintly-ui","description":"A library of reusable React components for building Sprintly UIs.","fork":false,"url":"https://api.github.com/repos/sprintly/sprintly-ui","forks_url":"https://api.github.com/repos/sprintly/sprintly-ui/forks","keys_url":"https://api.github.com/repos/sprintly/sprintly-ui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sprintly/sprintly-ui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sprintly/sprintly-ui/teams","hooks_url":"https://api.github.com/repos/sprintly/sprintly-ui/hooks","issue_events_url":"https://api.github.com/repos/sprintly/sprintly-ui/issues/events{/number}","events_url":"https://api.github.com/repos/sprintly/sprintly-ui/events","assignees_url":"https://api.github.com/repos/sprintly/sprintly-ui/assignees{/user}","branches_url":"https://api.github.com/repos/sprintly/sprintly-ui/branches{/branch}","tags_url":"https://api.github.com/repos/sprintly/sprintly-ui/tags","blobs_url":"https://api.github.com/repos/sprintly/sprintly-ui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sprintly/sprintly-ui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sprintly/sprintly-ui/git/refs{/sha}","trees_url":"https://api.github.com/repos/sprintly/sprintly-ui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sprintly/sprintly-ui/statuses/{sha}","languages_url":"https://api.github.com/repos/sprintly/sprintly-ui/languages","stargazers_url":"https://api.github.com/repos/sprintly/sprintly-ui/stargazers","contributors_url":"https://api.github.com/repos/sprintly/sprintly-ui/contributors","subscribers_url":"https://api.github.com/repos/sprintly/sprintly-ui/subscribers","subscription_url":"https://api.github.com/repos/sprintly/sprintly-ui/subscription","commits_url":"https://api.github.com/repos/sprintly/sprintly-ui/commits{/sha}","git_commits_url":"https://api.github.com/repos/sprintly/sprintly-ui/git/commits{/sha}","comments_url":"https://api.github.com/repos/sprintly/sprintly-ui/comments{/number}","issue_comment_url":"https://api.github.com/repos/sprintly/sprintly-ui/issues/comments{/number}","contents_url":"https://api.github.com/repos/sprintly/sprintly-ui/contents/{+path}","compare_url":"https://api.github.com/repos/sprintly/sprintly-ui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sprintly/sprintly-ui/merges","archive_url":"https://api.github.com/repos/sprintly/sprintly-ui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sprintly/sprintly-ui/downloads","issues_url":"https://api.github.com/repos/sprintly/sprintly-ui/issues{/number}","pulls_url":"https://api.github.com/repos/sprintly/sprintly-ui/pulls{/number}","milestones_url":"https://api.github.com/repos/sprintly/sprintly-ui/milestones{/number}","notifications_url":"https://api.github.com/repos/sprintly/sprintly-ui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sprintly/sprintly-ui/labels{/name}","releases_url":"https://api.github.com/repos/sprintly/sprintly-ui/releases{/id}","created_at":"2014-10-30T22:19:31Z","updated_at":"2015-03-12T20:33:35Z","pushed_at":"2015-03-31T04:33:51Z","git_url":"git://github.com/sprintly/sprintly-ui.git","ssh_url":"git@github.com:sprintly/sprintly-ui.git","clone_url":"https://github.com/sprintly/sprintly-ui.git","svn_url":"https://github.com/sprintly/sprintly-ui","homepage":null,"size":1076,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"sprintly:master","ref":"master","sha":"7a2ece3c63220fdee3e2034cbe4e658dd395576e","user":{"login":"sprintly","id":387934,"avatar_url":"https://avatars.githubusercontent.com/u/387934?v=3","gravatar_id":"","url":"https://api.github.com/users/sprintly","html_url":"https://github.com/sprintly","followers_url":"https://api.github.com/users/sprintly/followers","following_url":"https://api.github.com/users/sprintly/following{/other_user}","gists_url":"https://api.github.com/users/sprintly/gists{/gist_id}","starred_url":"https://api.github.com/users/sprintly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sprintly/subscriptions","organizations_url":"https://api.github.com/users/sprintly/orgs","repos_url":"https://api.github.com/users/sprintly/repos","events_url":"https://api.github.com/users/sprintly/events{/privacy}","received_events_url":"https://api.github.com/users/sprintly/received_events","type":"Organization","site_admin":false},"repo":{"id":25992114,"name":"sprintly-ui","full_name":"sprintly/sprintly-ui","owner":{"login":"sprintly","id":387934,"avatar_url":"https://avatars.githubusercontent.com/u/387934?v=3","gravatar_id":"","url":"https://api.github.com/users/sprintly","html_url":"https://github.com/sprintly","followers_url":"https://api.github.com/users/sprintly/followers","following_url":"https://api.github.com/users/sprintly/following{/other_user}","gists_url":"https://api.github.com/users/sprintly/gists{/gist_id}","starred_url":"https://api.github.com/users/sprintly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sprintly/subscriptions","organizations_url":"https://api.github.com/users/sprintly/orgs","repos_url":"https://api.github.com/users/sprintly/repos","events_url":"https://api.github.com/users/sprintly/events{/privacy}","received_events_url":"https://api.github.com/users/sprintly/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sprintly/sprintly-ui","description":"A library of reusable React components for building Sprintly UIs.","fork":false,"url":"https://api.github.com/repos/sprintly/sprintly-ui","forks_url":"https://api.github.com/repos/sprintly/sprintly-ui/forks","keys_url":"https://api.github.com/repos/sprintly/sprintly-ui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sprintly/sprintly-ui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sprintly/sprintly-ui/teams","hooks_url":"https://api.github.com/repos/sprintly/sprintly-ui/hooks","issue_events_url":"https://api.github.com/repos/sprintly/sprintly-ui/issues/events{/number}","events_url":"https://api.github.com/repos/sprintly/sprintly-ui/events","assignees_url":"https://api.github.com/repos/sprintly/sprintly-ui/assignees{/user}","branches_url":"https://api.github.com/repos/sprintly/sprintly-ui/branches{/branch}","tags_url":"https://api.github.com/repos/sprintly/sprintly-ui/tags","blobs_url":"https://api.github.com/repos/sprintly/sprintly-ui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sprintly/sprintly-ui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sprintly/sprintly-ui/git/refs{/sha}","trees_url":"https://api.github.com/repos/sprintly/sprintly-ui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sprintly/sprintly-ui/statuses/{sha}","languages_url":"https://api.github.com/repos/sprintly/sprintly-ui/languages","stargazers_url":"https://api.github.com/repos/sprintly/sprintly-ui/stargazers","contributors_url":"https://api.github.com/repos/sprintly/sprintly-ui/contributors","subscribers_url":"https://api.github.com/repos/sprintly/sprintly-ui/subscribers","subscription_url":"https://api.github.com/repos/sprintly/sprintly-ui/subscription","commits_url":"https://api.github.com/repos/sprintly/sprintly-ui/commits{/sha}","git_commits_url":"https://api.github.com/repos/sprintly/sprintly-ui/git/commits{/sha}","comments_url":"https://api.github.com/repos/sprintly/sprintly-ui/comments{/number}","issue_comment_url":"https://api.github.com/repos/sprintly/sprintly-ui/issues/comments{/number}","contents_url":"https://api.github.com/repos/sprintly/sprintly-ui/contents/{+path}","compare_url":"https://api.github.com/repos/sprintly/sprintly-ui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sprintly/sprintly-ui/merges","archive_url":"https://api.github.com/repos/sprintly/sprintly-ui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sprintly/sprintly-ui/downloads","issues_url":"https://api.github.com/repos/sprintly/sprintly-ui/issues{/number}","pulls_url":"https://api.github.com/repos/sprintly/sprintly-ui/pulls{/number}","milestones_url":"https://api.github.com/repos/sprintly/sprintly-ui/milestones{/number}","notifications_url":"https://api.github.com/repos/sprintly/sprintly-ui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sprintly/sprintly-ui/labels{/name}","releases_url":"https://api.github.com/repos/sprintly/sprintly-ui/releases{/id}","created_at":"2014-10-30T22:19:31Z","updated_at":"2015-03-12T20:33:35Z","pushed_at":"2015-03-31T04:33:51Z","git_url":"git://github.com/sprintly/sprintly-ui.git","ssh_url":"git@github.com:sprintly/sprintly-ui.git","clone_url":"https://github.com/sprintly/sprintly-ui.git","svn_url":"https://github.com/sprintly/sprintly-ui","homepage":null,"size":1076,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sprintly/sprintly-ui/pulls/12"},"html":{"href":"https://github.com/sprintly/sprintly-ui/pull/12"},"issue":{"href":"https://api.github.com/repos/sprintly/sprintly-ui/issues/12"},"comments":{"href":"https://api.github.com/repos/sprintly/sprintly-ui/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/sprintly/sprintly-ui/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/sprintly/sprintly-ui/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sprintly/sprintly-ui/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/sprintly/sprintly-ui/statuses/e220df39cf645ec8b439e8e0380f930b2ed26bc5"}}}}