{"action":"created","comment":{"url":"https://api.github.com/repos/coveo/search-ui/pulls/comments/205450515","pull_request_review_id":140718230,"id":205450515,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNTQ1MDUxNQ==","diff_hunk":"@@ -1285,11 +1286,34 @@ export class Facet extends Component {\n   protected facetValueHasChanged() {\n     this.updateQueryStateModel();\n     this.rebuildValueElements();\n+    this.clearDependentFacetsIfNoSelectedValuesRemain();\n     Defer.defer(() => {\n       this.updateAppearanceDependingOnState();\n     });\n   }\n \n+  private clearDependentFacetsIfNoSelectedValuesRemain() {\n+    if (this.getSelectedValues().length) {\n+      return;\n+    }\n+\n+    this.getDependentFacets().forEach(facet => facet.reset());\n+  }\n+\n+  private getDependentFacets() {\n+    const fieldOption = this.options.field;\n+    const facets = this.searchInterface.getComponents<Facet>(Facet.ID) || [];\n+    const dependentFacets: Facet[] = [];\n+\n+    facets.forEach(facet => {","path":"src/ui/Facet/Facet.ts","position":31,"original_position":31,"commit_id":"6ae56220cef0cd573600611d9fcf45884bb76e37","original_commit_id":"6ae56220cef0cd573600611d9fcf45884bb76e37","user":{"login":"olamothe","id":1591893,"node_id":"MDQ6VXNlcjE1OTE4OTM=","avatar_url":"https://avatars1.githubusercontent.com/u/1591893?v=4","gravatar_id":"","url":"https://api.github.com/users/olamothe","html_url":"https://github.com/olamothe","followers_url":"https://api.github.com/users/olamothe/followers","following_url":"https://api.github.com/users/olamothe/following{/other_user}","gists_url":"https://api.github.com/users/olamothe/gists{/gist_id}","starred_url":"https://api.github.com/users/olamothe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olamothe/subscriptions","organizations_url":"https://api.github.com/users/olamothe/orgs","repos_url":"https://api.github.com/users/olamothe/repos","events_url":"https://api.github.com/users/olamothe/events{/privacy}","received_events_url":"https://api.github.com/users/olamothe/received_events","type":"User","site_admin":false},"body":"Hum, it's kind of a lot of \"wasted\" processing everytime a facet value changes, because dependant facet are not used a lot, but this means that all facets must always scan for all others everytime.\r\n\r\nI think I would reverse the logic, and make it so the dependant facet is in charge of unselecting it's value when needed, versus making it the parent's duty (because the parents does not know that it is controlling another facet).\r\n\r\nSomething like this pseudo in the constructor of each facet\r\n```\r\nif(this.dependsOnAnotherfacet()) {\r\n  this.bind.onQueryState('state:change:f@parentFacet', ()=> checkIfParentHasSelectedOrExcludedValueAndUnselectIfNeeded())\r\n}\r\n\r\n```","created_at":"2018-07-26T13:15:30Z","updated_at":"2018-07-26T13:17:03Z","html_url":"https://github.com/coveo/search-ui/pull/888#discussion_r205450515","pull_request_url":"https://api.github.com/repos/coveo/search-ui/pulls/888","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/coveo/search-ui/pulls/comments/205450515"},"html":{"href":"https://github.com/coveo/search-ui/pull/888#discussion_r205450515"},"pull_request":{"href":"https://api.github.com/repos/coveo/search-ui/pulls/888"}}},"pull_request":{"url":"https://api.github.com/repos/coveo/search-ui/pulls/888","id":203983841,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAzOTgzODQx","html_url":"https://github.com/coveo/search-ui/pull/888","diff_url":"https://github.com/coveo/search-ui/pull/888.diff","patch_url":"https://github.com/coveo/search-ui/pull/888.patch","issue_url":"https://api.github.com/repos/coveo/search-ui/issues/888","number":888,"state":"open","locked":false,"title":"JSUI-2189  Resetting dependent facets when no parent facet options are selected","user":{"login":"samisayegh","id":5565841,"node_id":"MDQ6VXNlcjU1NjU4NDE=","avatar_url":"https://avatars2.githubusercontent.com/u/5565841?v=4","gravatar_id":"","url":"https://api.github.com/users/samisayegh","html_url":"https://github.com/samisayegh","followers_url":"https://api.github.com/users/samisayegh/followers","following_url":"https://api.github.com/users/samisayegh/following{/other_user}","gists_url":"https://api.github.com/users/samisayegh/gists{/gist_id}","starred_url":"https://api.github.com/users/samisayegh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samisayegh/subscriptions","organizations_url":"https://api.github.com/users/samisayegh/orgs","repos_url":"https://api.github.com/users/samisayegh/repos","events_url":"https://api.github.com/users/samisayegh/events{/privacy}","received_events_url":"https://api.github.com/users/samisayegh/received_events","type":"User","site_admin":false},"body":"\r\n\r\n\r\n[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://dashboard.heroku.com/pipelines/a3535101-5bbf-4a5b-a909-47fcf8c9f149)","created_at":"2018-07-25T22:44:43Z","updated_at":"2018-07-26T13:17:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e29f4bd22ac9950ecc2940d6214fd866f7f87b3e","assignee":null,"assignees":[],"requested_reviewers":[{"login":"huppeje","id":39059543,"node_id":"MDQ6VXNlcjM5MDU5NTQz","avatar_url":"https://avatars0.githubusercontent.com/u/39059543?v=4","gravatar_id":"","url":"https://api.github.com/users/huppeje","html_url":"https://github.com/huppeje","followers_url":"https://api.github.com/users/huppeje/followers","following_url":"https://api.github.com/users/huppeje/following{/other_user}","gists_url":"https://api.github.com/users/huppeje/gists{/gist_id}","starred_url":"https://api.github.com/users/huppeje/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huppeje/subscriptions","organizations_url":"https://api.github.com/users/huppeje/orgs","repos_url":"https://api.github.com/users/huppeje/repos","events_url":"https://api.github.com/users/huppeje/events{/privacy}","received_events_url":"https://api.github.com/users/huppeje/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/coveo/search-ui/pulls/888/commits","review_comments_url":"https://api.github.com/repos/coveo/search-ui/pulls/888/comments","review_comment_url":"https://api.github.com/repos/coveo/search-ui/pulls/comments{/number}","comments_url":"https://api.github.com/repos/coveo/search-ui/issues/888/comments","statuses_url":"https://api.github.com/repos/coveo/search-ui/statuses/6ae56220cef0cd573600611d9fcf45884bb76e37","head":{"label":"coveo:JSUI-2189","ref":"JSUI-2189","sha":"6ae56220cef0cd573600611d9fcf45884bb76e37","user":{"login":"coveo","id":8632328,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg2MzIzMjg=","avatar_url":"https://avatars2.githubusercontent.com/u/8632328?v=4","gravatar_id":"","url":"https://api.github.com/users/coveo","html_url":"https://github.com/coveo","followers_url":"https://api.github.com/users/coveo/followers","following_url":"https://api.github.com/users/coveo/following{/other_user}","gists_url":"https://api.github.com/users/coveo/gists{/gist_id}","starred_url":"https://api.github.com/users/coveo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coveo/subscriptions","organizations_url":"https://api.github.com/users/coveo/orgs","repos_url":"https://api.github.com/users/coveo/repos","events_url":"https://api.github.com/users/coveo/events{/privacy}","received_events_url":"https://api.github.com/users/coveo/received_events","type":"Organization","site_admin":false},"repo":{"id":58133471,"node_id":"MDEwOlJlcG9zaXRvcnk1ODEzMzQ3MQ==","name":"search-ui","full_name":"coveo/search-ui","owner":{"login":"coveo","id":8632328,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg2MzIzMjg=","avatar_url":"https://avatars2.githubusercontent.com/u/8632328?v=4","gravatar_id":"","url":"https://api.github.com/users/coveo","html_url":"https://github.com/coveo","followers_url":"https://api.github.com/users/coveo/followers","following_url":"https://api.github.com/users/coveo/following{/other_user}","gists_url":"https://api.github.com/users/coveo/gists{/gist_id}","starred_url":"https://api.github.com/users/coveo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coveo/subscriptions","organizations_url":"https://api.github.com/users/coveo/orgs","repos_url":"https://api.github.com/users/coveo/repos","events_url":"https://api.github.com/users/coveo/events{/privacy}","received_events_url":"https://api.github.com/users/coveo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/coveo/search-ui","description":"Coveo Search UI framework","fork":false,"url":"https://api.github.com/repos/coveo/search-ui","forks_url":"https://api.github.com/repos/coveo/search-ui/forks","keys_url":"https://api.github.com/repos/coveo/search-ui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/coveo/search-ui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/coveo/search-ui/teams","hooks_url":"https://api.github.com/repos/coveo/search-ui/hooks","issue_events_url":"https://api.github.com/repos/coveo/search-ui/issues/events{/number}","events_url":"https://api.github.com/repos/coveo/search-ui/events","assignees_url":"https://api.github.com/repos/coveo/search-ui/assignees{/user}","branches_url":"https://api.github.com/repos/coveo/search-ui/branches{/branch}","tags_url":"https://api.github.com/repos/coveo/search-ui/tags","blobs_url":"https://api.github.com/repos/coveo/search-ui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/coveo/search-ui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/coveo/search-ui/git/refs{/sha}","trees_url":"https://api.github.com/repos/coveo/search-ui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/coveo/search-ui/statuses/{sha}","languages_url":"https://api.github.com/repos/coveo/search-ui/languages","stargazers_url":"https://api.github.com/repos/coveo/search-ui/stargazers","contributors_url":"https://api.github.com/repos/coveo/search-ui/contributors","subscribers_url":"https://api.github.com/repos/coveo/search-ui/subscribers","subscription_url":"https://api.github.com/repos/coveo/search-ui/subscription","commits_url":"https://api.github.com/repos/coveo/search-ui/commits{/sha}","git_commits_url":"https://api.github.com/repos/coveo/search-ui/git/commits{/sha}","comments_url":"https://api.github.com/repos/coveo/search-ui/comments{/number}","issue_comment_url":"https://api.github.com/repos/coveo/search-ui/issues/comments{/number}","contents_url":"https://api.github.com/repos/coveo/search-ui/contents/{+path}","compare_url":"https://api.github.com/repos/coveo/search-ui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/coveo/search-ui/merges","archive_url":"https://api.github.com/repos/coveo/search-ui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/coveo/search-ui/downloads","issues_url":"https://api.github.com/repos/coveo/search-ui/issues{/number}","pulls_url":"https://api.github.com/repos/coveo/search-ui/pulls{/number}","milestones_url":"https://api.github.com/repos/coveo/search-ui/milestones{/number}","notifications_url":"https://api.github.com/repos/coveo/search-ui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/coveo/search-ui/labels{/name}","releases_url":"https://api.github.com/repos/coveo/search-ui/releases{/id}","deployments_url":"https://api.github.com/repos/coveo/search-ui/deployments","created_at":"2016-05-05T13:41:09Z","updated_at":"2018-07-24T21:32:51Z","pushed_at":"2018-07-25T22:44:44Z","git_url":"git://github.com/coveo/search-ui.git","ssh_url":"git@github.com:coveo/search-ui.git","clone_url":"https://github.com/coveo/search-ui.git","svn_url":"https://github.com/coveo/search-ui","homepage":null,"size":146463,"stargazers_count":49,"watchers_count":49,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":46,"mirror_url":null,"archived":false,"open_issues_count":6,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":46,"open_issues":6,"watchers":49,"default_branch":"master"}},"base":{"label":"coveo:master","ref":"master","sha":"19c8788ede744d1d6e3cef15021dc68fa3c90902","user":{"login":"coveo","id":8632328,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg2MzIzMjg=","avatar_url":"https://avatars2.githubusercontent.com/u/8632328?v=4","gravatar_id":"","url":"https://api.github.com/users/coveo","html_url":"https://github.com/coveo","followers_url":"https://api.github.com/users/coveo/followers","following_url":"https://api.github.com/users/coveo/following{/other_user}","gists_url":"https://api.github.com/users/coveo/gists{/gist_id}","starred_url":"https://api.github.com/users/coveo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coveo/subscriptions","organizations_url":"https://api.github.com/users/coveo/orgs","repos_url":"https://api.github.com/users/coveo/repos","events_url":"https://api.github.com/users/coveo/events{/privacy}","received_events_url":"https://api.github.com/users/coveo/received_events","type":"Organization","site_admin":false},"repo":{"id":58133471,"node_id":"MDEwOlJlcG9zaXRvcnk1ODEzMzQ3MQ==","name":"search-ui","full_name":"coveo/search-ui","owner":{"login":"coveo","id":8632328,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg2MzIzMjg=","avatar_url":"https://avatars2.githubusercontent.com/u/8632328?v=4","gravatar_id":"","url":"https://api.github.com/users/coveo","html_url":"https://github.com/coveo","followers_url":"https://api.github.com/users/coveo/followers","following_url":"https://api.github.com/users/coveo/following{/other_user}","gists_url":"https://api.github.com/users/coveo/gists{/gist_id}","starred_url":"https://api.github.com/users/coveo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coveo/subscriptions","organizations_url":"https://api.github.com/users/coveo/orgs","repos_url":"https://api.github.com/users/coveo/repos","events_url":"https://api.github.com/users/coveo/events{/privacy}","received_events_url":"https://api.github.com/users/coveo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/coveo/search-ui","description":"Coveo Search UI framework","fork":false,"url":"https://api.github.com/repos/coveo/search-ui","forks_url":"https://api.github.com/repos/coveo/search-ui/forks","keys_url":"https://api.github.com/repos/coveo/search-ui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/coveo/search-ui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/coveo/search-ui/teams","hooks_url":"https://api.github.com/repos/coveo/search-ui/hooks","issue_events_url":"https://api.github.com/repos/coveo/search-ui/issues/events{/number}","events_url":"https://api.github.com/repos/coveo/search-ui/events","assignees_url":"https://api.github.com/repos/coveo/search-ui/assignees{/user}","branches_url":"https://api.github.com/repos/coveo/search-ui/branches{/branch}","tags_url":"https://api.github.com/repos/coveo/search-ui/tags","blobs_url":"https://api.github.com/repos/coveo/search-ui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/coveo/search-ui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/coveo/search-ui/git/refs{/sha}","trees_url":"https://api.github.com/repos/coveo/search-ui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/coveo/search-ui/statuses/{sha}","languages_url":"https://api.github.com/repos/coveo/search-ui/languages","stargazers_url":"https://api.github.com/repos/coveo/search-ui/stargazers","contributors_url":"https://api.github.com/repos/coveo/search-ui/contributors","subscribers_url":"https://api.github.com/repos/coveo/search-ui/subscribers","subscription_url":"https://api.github.com/repos/coveo/search-ui/subscription","commits_url":"https://api.github.com/repos/coveo/search-ui/commits{/sha}","git_commits_url":"https://api.github.com/repos/coveo/search-ui/git/commits{/sha}","comments_url":"https://api.github.com/repos/coveo/search-ui/comments{/number}","issue_comment_url":"https://api.github.com/repos/coveo/search-ui/issues/comments{/number}","contents_url":"https://api.github.com/repos/coveo/search-ui/contents/{+path}","compare_url":"https://api.github.com/repos/coveo/search-ui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/coveo/search-ui/merges","archive_url":"https://api.github.com/repos/coveo/search-ui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/coveo/search-ui/downloads","issues_url":"https://api.github.com/repos/coveo/search-ui/issues{/number}","pulls_url":"https://api.github.com/repos/coveo/search-ui/pulls{/number}","milestones_url":"https://api.github.com/repos/coveo/search-ui/milestones{/number}","notifications_url":"https://api.github.com/repos/coveo/search-ui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/coveo/search-ui/labels{/name}","releases_url":"https://api.github.com/repos/coveo/search-ui/releases{/id}","deployments_url":"https://api.github.com/repos/coveo/search-ui/deployments","created_at":"2016-05-05T13:41:09Z","updated_at":"2018-07-24T21:32:51Z","pushed_at":"2018-07-25T22:44:44Z","git_url":"git://github.com/coveo/search-ui.git","ssh_url":"git@github.com:coveo/search-ui.git","clone_url":"https://github.com/coveo/search-ui.git","svn_url":"https://github.com/coveo/search-ui","homepage":null,"size":146463,"stargazers_count":49,"watchers_count":49,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":46,"mirror_url":null,"archived":false,"open_issues_count":6,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":46,"open_issues":6,"watchers":49,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/coveo/search-ui/pulls/888"},"html":{"href":"https://github.com/coveo/search-ui/pull/888"},"issue":{"href":"https://api.github.com/repos/coveo/search-ui/issues/888"},"comments":{"href":"https://api.github.com/repos/coveo/search-ui/issues/888/comments"},"review_comments":{"href":"https://api.github.com/repos/coveo/search-ui/pulls/888/comments"},"review_comment":{"href":"https://api.github.com/repos/coveo/search-ui/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/coveo/search-ui/pulls/888/commits"},"statuses":{"href":"https://api.github.com/repos/coveo/search-ui/statuses/6ae56220cef0cd573600611d9fcf45884bb76e37"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"olamothe"}}