Title: Angular/elements OnPush input changes does not trigger change detection · Issue #38948 · angular/angular · GitHub
Open Graph Title: Angular/elements OnPush input changes does not trigger change detection · Issue #38948 · angular/angular
X Title: Angular/elements OnPush input changes does not trigger change detection · Issue #38948 · angular/angular
Description: 🐞 bug report Affected Package The issue is caused by package @angular/elements Is this a regression? dunno Description create custom elements via @angular/elements from component with input and changeDetection: ChangeDetectionStrategy.On...
Open Graph Description: 🐞 bug report Affected Package The issue is caused by package @angular/elements Is this a regression? dunno Description create custom elements via @angular/elements from component with input and cha...
X Description: 🐞 bug report Affected Package The issue is caused by package @angular/elements Is this a regression? dunno Description create custom elements via @angular/elements from component with input and cha...
Opengraph URL: https://github.com/angular/angular/issues/38948
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Angular/elements OnPush input changes does not trigger change detection","articleBody":"# 🐞 bug report\r\n\r\n### Affected Package\r\n\u003c!-- Can you pin-point one or more @angular/* packages as the source of the bug? -->\r\n\u003c!-- ✍️edit: --> The issue is caused by package @angular/elements\r\n\r\n\r\n### Is this a regression?\r\n\r\n\u003c!-- Did this behavior use to work in the previous version? -->\r\n\u003c!-- ✍️--> dunno\r\n\r\n\r\n### Description\r\n\r\n- create custom elements via @angular/elements from component with input and `changeDetection: ChangeDetectionStrategy.OnPush`\r\n- set it's initial input value from the application or change it\r\n- component's CD is not triggered, template is not updated\r\n\r\n## 🔬 Minimal Reproduction\r\n\r\nClone https://github.com/artaommahe/Angular-elements-input-update. There are two applications: `widgets` with custom element and `main-app` with custom element usage in other angular app.\r\n\r\nTwo ways to face the issue - from `main-app` or from plain js custom element usage.\r\n\r\n##### Plain js\r\n\r\nplatform's code here https://github.com/artaommahe/Angular-elements-input-update/blob/master/projects/widgets/src/index.html#L11\r\n\r\n- run `widgets` dev server `yarn start widgets`\r\n- open `http://localhost:4201/`\r\n- click `inc` button multiple times\r\n- see no changes in widget's template\r\n- click `trigger widget CD` button (runs markForCheck inside widget component)\r\n- see changes\r\n- uncomment this https://github.com/artaommahe/Angular-elements-input-update/blob/master/projects/widgets/src/app/some-widget/components/some-widget/some-widget.component.ts#L17\r\n- update page and click `inc` button\r\n- see changes\r\n\r\n##### Other angular app\r\n\r\nplatform's code here https://github.com/artaommahe/Angular-elements-input-update/blob/master/projects/main-app/src/app/app.component.ts#L6\r\n\r\n- run `widgets` dev server `yarn start widgets --extra-webpack-config projects/widgets/webpack.config.js` (we cant run two angular-cli apps in one browser tab webpack config changes https://github.com/angular/angular-cli/issues/8902)\r\n- run `main-app` dev server `yarn start main-app`\r\n- open `http://localhost:4200/`\r\n- click `inc` button multiple times\r\n- see no changes in widget's template\r\n- click `trigger widget CD` button (runs markForCheck inside widget component)\r\n- see changes\r\n- uncomment this https://github.com/artaommahe/Angular-elements-input-update/blob/master/projects/widgets/src/app/some-widget/components/some-widget/some-widget.component.ts#L17\r\n- update page and click `inc` button\r\n- see changes\r\n\r\nor you can remove `ChangeDetectionStrategy.OnPush` in `some-widget` component and everything will work too\r\n\r\n## 🔥 Exception or Error\r\n\r\n\r\n\r\n## 🌍 Your Environment\r\n\r\n**Angular Version:**\r\n\u003cpre>\u003ccode>\r\nPS D:\\projects\\issues\\angular-elements-input-update> yarn ng version \r\nyarn run v1.16.0\r\n$ ng version\r\n\r\n _ _ ____ _ ___\r\n / \\ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|\r\n / △ \\ | '_ \\ / _` | | | | |/ _` | '__| | | | | | |\r\n / ___ \\| | | | (_| | |_| | | (_| | | | |___| |___ | |\r\n /_/ \\_\\_| |_|\\__, |\\__,_|_|\\__,_|_| \\____|_____|___|\r\n |___/\r\n \r\n\r\nAngular CLI: 10.1.2\r\nNode: 12.18.1\r\nOS: win32 x64\r\n\r\nAngular: 10.1.2\r\n... animations, cli, common, compiler, compiler-cli, core\r\n... elements, forms, platform-browser, platform-browser-dynamic\r\n... router\r\nIvy Workspace: Yes\r\n\r\nPackage Version\r\n---------------------------------------------------------\r\n@angular-devkit/architect 0.1001.2\r\n@angular-devkit/build-angular 0.1001.2\r\n@angular-devkit/core 10.1.2\r\n@angular-devkit/schematics 10.1.2\r\n@schematics/angular 10.1.2\r\n@schematics/update 0.1001.2\r\nrxjs 6.6.3\r\ntypescript 4.0.3\r\n\u003c/code>\u003c/pre>\r\n\r\n**Anything else relevant?**\r\n","author":{"url":"https://github.com/artaommahe","@type":"Person","name":"artaommahe"},"datePublished":"2020-09-23T13:14:41Z","url":"https://github.com/angular/angular/issues/38948"}
| 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:c0ca4319-363a-dd10-2318-603472efcc75 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9B06:96DDF:CC7BD4:10423C5:6B00FDB4 |
| html-safe-nonce | 4cd76fe1188bc3ca3a21901e73982bc3b61f24d21c0c00c028f544bd5115527d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QjA2Ojk2RERGOkNDN0JENDoxMDQyM0M1OjZCMDBGREI0IiwidmlzaXRvcl9pZCI6Ijg3NDgwNjE1MDI3ODg5MjY5MDAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | b1f686477276dd4857ac592b1f26e115b78cdf873f07b757ff9845f977b3f5c0 |
| hovercard-subject-tag | issue:707356883 |
| 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/38948/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f71f2e9e12c9add509319688bf334c23b4393a640d142c58ea27f8e22e06f05e/angular/angular/issues/38948 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f71f2e9e12c9add509319688bf334c23b4393a640d142c58ea27f8e22e06f05e/angular/angular/issues/38948 |
| og:image:alt | 🐞 bug report Affected Package The issue is caused by package @angular/elements Is this a regression? dunno Description create custom elements via @angular/elements from component with input and cha... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | artaommahe |
| hostname | github.com |
| expected-hostname | github.com |
| None | e208d86428ec00a57ade75058166297440e8128a01e5287c31a53dc042bbf187 |
| 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 | 7dafd017fb7809a839c443dba08622af38e63c09 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width