{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular/issues/22461","repository_url":"https://api.github.com/repos/angular/angular","labels_url":"https://api.github.com/repos/angular/angular/issues/22461/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular/issues/22461/comments","events_url":"https://api.github.com/repos/angular/angular/issues/22461/events","html_url":"https://github.com/angular/angular/issues/22461","id":300403528,"number":22461,"title":"Parent component change detection strategy being inherited by descendants","user":{"login":"admosity","id":4655972,"avatar_url":"https://avatars2.githubusercontent.com/u/4655972?v=4","gravatar_id":"","url":"https://api.github.com/users/admosity","html_url":"https://github.com/admosity","followers_url":"https://api.github.com/users/admosity/followers","following_url":"https://api.github.com/users/admosity/following{/other_user}","gists_url":"https://api.github.com/users/admosity/gists{/gist_id}","starred_url":"https://api.github.com/users/admosity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/admosity/subscriptions","organizations_url":"https://api.github.com/users/admosity/orgs","repos_url":"https://api.github.com/users/admosity/repos","events_url":"https://api.github.com/users/admosity/events{/privacy}","received_events_url":"https://api.github.com/users/admosity/received_events","type":"User","site_admin":false},"labels":[{"id":375501288,"url":"https://api.github.com/repos/angular/angular/labels/comp:%20core%20&%20compiler","name":"comp: core & compiler","color":"c7def8","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/angular/angular/milestones/83","html_url":"https://github.com/angular/angular/milestone/83","labels_url":"https://api.github.com/repos/angular/angular/milestones/83/labels","id":3143880,"number":83,"title":"needsTriage","description":"Milestone for all issues that haven't been triaged yet","creator":{"login":"ocombe","id":265378,"avatar_url":"https://avatars0.githubusercontent.com/u/265378?v=4","gravatar_id":"","url":"https://api.github.com/users/ocombe","html_url":"https://github.com/ocombe","followers_url":"https://api.github.com/users/ocombe/followers","following_url":"https://api.github.com/users/ocombe/following{/other_user}","gists_url":"https://api.github.com/users/ocombe/gists{/gist_id}","starred_url":"https://api.github.com/users/ocombe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ocombe/subscriptions","organizations_url":"https://api.github.com/users/ocombe/orgs","repos_url":"https://api.github.com/users/ocombe/repos","events_url":"https://api.github.com/users/ocombe/events{/privacy}","received_events_url":"https://api.github.com/users/ocombe/received_events","type":"User","site_admin":false},"open_issues":436,"closed_issues":189,"state":"open","created_at":"2018-02-26T14:22:18Z","updated_at":"2018-03-29T22:59:15Z","due_on":null,"closed_at":null},"comments":0,"created_at":"2018-02-26T21:31:19Z","updated_at":"2018-03-29T22:59:15Z","closed_at":"2018-03-29T22:59:15Z","author_association":"NONE","body":"<!--\r\nPLEASE HELP US PROCESS GITHUB ISSUES FASTER BY PROVIDING THE FOLLOWING INFORMATION.\r\n\r\nISSUES MISSING IMPORTANT INFORMATION MAY BE CLOSED WITHOUT INVESTIGATION.\r\n-->\r\n\r\n## I'm submitting a...\r\n```\r\n[x] Feature request\r\n```\r\n## Current behavior\r\n<!-- Describe how the issue manifests. -->\r\nSetting the change detection strategy of a parent component to `OnPush` \"sets\" the change detection strategy of all descendants in the same tree to `OnPush` or so it seems. I understand that change detection is skipped if a parent hasn't changed, but if a child performs a change worthy event (such as calling `setTimeout`) and doesn't itself have its change detection set to `OnPush`, shouldn't it still trigger change detection for itself?\r\n\r\n\r\n## Expected behavior\r\n<!-- Describe what the desired behavior would be. -->\r\nSwitching the change detection strategy in a parent component should not set the change detection strategy for all the components in the same tree.\r\n\r\n## Minimal reproduction of the problem with instructions\r\nHere's a set of examples on angular 4 and 5 with an example of a 2 layer deep parent:\r\nhttps://stackblitz.com/edit/angular4-parent-child-change-detection?file=app%2Fapp.component.html\r\nhttps://stackblitz.com/edit/angular5-parent-child-change-detection1?file=app/app.component.html\r\n\r\n## What is the motivation / use case for changing the behavior?\r\n<!-- Describe the motivation or the concrete use case. -->\r\nWe are migrating some codebases to a smart/presentational component architecture and it seems that it's not quite possible to do it piecemeal with container components affecting descendants.\r\n\r\nWe have a large distributed team that used `setTimeout` quite often to trigger change detection or perform operations on the next tick. API calls that used to work are not triggering changes either. It also seems to be a break in encapsulation that the parent component's change detection strategy affects a child's. This also affects projected content.\r\n\r\n## Environment\r\n\r\n<pre><code>\r\nAngular version: ^4.0.0 and ^5.0.0\r\n<!-- Check whether this is still an issue in the most recent Angular version -->\r\n\r\nBrowser:\r\n- [ ] Chrome (desktop) version 64.0.3282.167\r\n\r\n \r\nFor Tooling issues:\r\n- Node version: v8.7.0\r\n- Platform:  Mac\r\n</code></pre>\r\n"},"comment":{"url":"https://api.github.com/repos/angular/angular/issues/comments/377397745","html_url":"https://github.com/angular/angular/issues/22461#issuecomment-377397745","issue_url":"https://api.github.com/repos/angular/angular/issues/22461","id":377397745,"user":{"login":"mhevery","id":111951,"avatar_url":"https://avatars0.githubusercontent.com/u/111951?v=4","gravatar_id":"","url":"https://api.github.com/users/mhevery","html_url":"https://github.com/mhevery","followers_url":"https://api.github.com/users/mhevery/followers","following_url":"https://api.github.com/users/mhevery/following{/other_user}","gists_url":"https://api.github.com/users/mhevery/gists{/gist_id}","starred_url":"https://api.github.com/users/mhevery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhevery/subscriptions","organizations_url":"https://api.github.com/users/mhevery/orgs","repos_url":"https://api.github.com/users/mhevery/repos","events_url":"https://api.github.com/users/mhevery/events{/privacy}","received_events_url":"https://api.github.com/users/mhevery/received_events","type":"User","site_admin":false},"created_at":"2018-03-29T22:59:14Z","updated_at":"2018-03-29T22:59:14Z","author_association":"OWNER","body":"This is by design. "}}
{"actor":{"display_login":"mhevery"}}