Title: Upgraded OnPush components do not trigger change detection on Output emission · Issue #24690 · angular/angular · GitHub
Open Graph Title: Upgraded OnPush components do not trigger change detection on Output emission · Issue #24690 · angular/angular
X Title: Upgraded OnPush components do not trigger change detection on Output emission · Issue #24690 · angular/angular
Description: I'm submitting a... [ ] Regression (a behavior that used to work and stopped working in a new release) [ ] Bug report [ ] Performance issue [ ] Feature request [X] Documentation issue or request [ ] Support request => Please do not submi...
Open Graph Description: I'm submitting a... [ ] Regression (a behavior that used to work and stopped working in a new release) [ ] Bug report [ ] Performance issue [ ] Feature request [X] Documentation issue or request [ ...
X Description: I'm submitting a... [ ] Regression (a behavior that used to work and stopped working in a new release) [ ] Bug report [ ] Performance issue [ ] Feature request [X] Documentation issue or reques...
Opengraph URL: https://github.com/angular/angular/issues/24690
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Upgraded OnPush components do not trigger change detection on Output emission","articleBody":"\u003c!--\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\u003c!-- Check one of the following options with \"x\" -->\r\n\u003cpre>\u003ccode>\r\n[ ] Regression (a behavior that used to work and stopped working in a new release)\r\n[ ] Bug report \u003c!-- Please search GitHub for a similar issue or PR before submitting -->\r\n[ ] Performance issue\r\n[ ] Feature request\r\n[X] Documentation issue or request\r\n[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question\r\n[ ] Other... Please describe:\r\n\u003c/code>\u003c/pre>\r\n\r\n## Current behavior\r\n\u003c!-- Describe how the issue manifests. -->\r\n\r\nI'm actually not sure whether this behavior is a bug or a documentation issue. I'm seeing that at some scenario described below, outputs emitted in ngOnInit are lost, but correctly processed when emitted in ngAfterViewInit. One requirement is that all components have OnPush change detection strategy. However, I'm not able to create a small reproduction example, because it always works.\r\n\r\nBasically, the scenario consists of root component and two subcomponents. The first subcomponent emits an event in ngOnInit. Root component subscribes to this output, and saves the event into a variable, which is bound as an input to the second subcomponent. But, writing a demo this way works fine.\r\n\r\nIn the real-world example, it is a hybrid app. The root component is upgraded, and the hierarchy is a bit more complicated. Even when done that way, it works when the root component is visited for the first time. It breaks when ui-router destroys the root component and navigates back to it.\r\n\r\nMaybe this is just a bug somewhere (angular-upgrade, ui-router, angular core, etc.) If so and one of the requirement is using a hybrid app / upgrade, then I don't think it is worth the time fixing it / finding a reproduction scenario.\r\n\r\nBut, I think that more likely it is just a documentation issue. If I understand the current documentation correctly, ngOnInit is called after inputs are initialized, but there is no word about outputs, which need not be subscribed yet. If my interpretation is correct, it would be nice that this would be emphasized in the paragraph about ngOnInit.\r\n\r\nNevertheless, if my interpretation is not correct, then it would be nice to mention Output in the paragraph about ngOnInit too.\r\n\r\n## Expected behavior\r\n\u003c!-- Describe what the desired behavior would be. -->\r\n\r\nAt least, some clarification about Output and lifecycle callbacks in the documentation would be nice.\r\n\r\n## Minimal reproduction of the problem with instructions\r\n\u003c!--\r\nFor bug reports please provide the *STEPS TO REPRODUCE* and if possible a *MINIMAL DEMO* of the problem via\r\nhttps://stackblitz.com or similar (you can use this template as a starting point: https://stackblitz.com/fork/angular-gitter).\r\n-->\r\n\r\nI was unable to provide a problem demonstration, but here is a code snippet which I've created when trying to demonstrate the problem (unsuccessfully):\r\n\r\nhttps://stackblitz.com/edit/angular-gitter-vvottn\r\n\r\n## What is the motivation / use case for changing the behavior?\r\n\u003c!-- Describe the motivation or the concrete use case. -->\r\n\r\nCurrently, I cannot find anything relevant about this topic both in official documentation, and various third-party articles, forum discussion, etc.\r\n\r\n\r\n## Environment\r\n\r\n\u003cpre>\u003ccode>\r\nAngular version: 6.0.3\r\n\u003c!-- Check whether this is still an issue in the most recent Angular version -->\r\n\r\nBrowser:\r\n- [X] Chrome (desktop) version 67.0.3396.99\r\n \r\nFor Tooling issues:\r\n- Node version: 8.11.2\r\n- Platform: Linux\r\n","author":{"url":"https://github.com/sebek64","@type":"Person","name":"sebek64"},"datePublished":"2018-06-27T14:07:51Z","url":"https://github.com/angular/angular/issues/24690"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:90309d20-303e-7cff-845a-e1106381e318 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A564:1C94F:23DD20:2DD229:6B00FFBB |
| html-safe-nonce | f497ac31ffdef073daec72b76b9695904ff580200ff2053054dd9aadffa3314b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNTY0OjFDOTRGOjIzREQyMDoyREQyMjk6NkIwMEZGQkIiLCJ2aXNpdG9yX2lkIjoiNTcxNjcxNjkzNzY0OTE5MjI3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 928e45c2dfea37a1ebc7163d221aa29d154186689fb59904b99138284e7f366b |
| hovercard-subject-tag | issue:336246251 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/24690/issue_layout |
| twitter:image | https://opengraph.githubassets.com/eb800affd6e35f35c2ef7177c9f8204edc137ea53b65503d6341444410835a3f/angular/angular/issues/24690 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/eb800affd6e35f35c2ef7177c9f8204edc137ea53b65503d6341444410835a3f/angular/angular/issues/24690 |
| og:image:alt | I'm submitting a... [ ] Regression (a behavior that used to work and stopped working in a new release) [ ] Bug report [ ] Performance issue [ ] Feature request [X] Documentation issue or request [ ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sebek64 |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124 |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width