-
Notifications
You must be signed in to change notification settings - Fork 27.1k
[9.1.x] fix(elements): fire custom element output events during component initialization #37231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
You can preview 8b01c66 at https://pr37231-8b01c66.ngbuilds.io/. |
|
You can preview e701ce8 at https://pr37231-e701ce8.ngbuilds.io/. |
|
You can preview 7db450e at https://pr37231-7db450e.ngbuilds.io/. |
|
@ caretaker: This needs to go into 9.1.x. |
…y` type-casts This commit removes some unnecessary non-null assertions (`!`) and `as any` type-casts from the `elements` package.
…tialization Previously, event listeners for component output events attached on an Angular custom element before inserting it into the DOM (i.e. before instantiating the underlying component) didn't fire for events emitted during initialization lifecycle hooks, such as `ngAfterContentInit`, `ngAfterViewInit`, `ngOnChanges` (initial call) and `ngOnInit`. The reason was that that `NgElementImpl` [subscribed to events][1] _after_ calling [ngElementStrategy#connect()][2], which is where the [initial change detection][3] takes place (running the initialization lifecycle hooks). This commit fixes this by: 1. Ensuring `ComponentNgElementStrategy#events` is defined and available for subscribing to, even before instantiating the component. 2. Ensuring `NgElementImpl` subscribes to `NgElementStrategy#events` before calling `NgElementStrategy#connect()` (which initializes the component instance). Jira issue: [FW-2010](https://angular-team.atlassian.net/browse/FW-2010) [1]: https://github.com/angular/angular/blob/c0143cb2abdd172de1b95fd1d2c4cfc738640e28/packages/elements/src/create-custom-element.ts#L167-L170 [2]: https://github.com/angular/angular/blob/c0143cb2abdd172de1b95fd1d2c4cfc738640e28/packages/elements/src/create-custom-element.ts#L164 [3]: https://github.com/angular/angular/blob/c0143cb2abdd172de1b95fd1d2c4cfc738640e28/packages/elements/src/component-factory-strategy.ts#L158 Fixes angular#36141
|
You can preview 6dac2d1 at https://pr37231-6dac2d1.ngbuilds.io/. |
|
You can preview 454e073 at https://pr37231-454e073.ngbuilds.io/. |
|
I removed the presubmit label - we don't need presubmit for non-master PRs. |
IgorMinar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. thanks!
|
merge-assitance: This PR doesn't need g3 presubmit. Can you please check with dev-infra why the PR status is pending? This is a bug that likely needs to be filed. thanks |
IgorMinar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed-for: global-approvers
…ngular#37399) Disabling Android 10 browser unit tests on Saucelabs due to errors. After remediation from Saucelabs to correct the discovered failures, this change can be reverted to renable the tests on Android 10. Example of failures seen: ``` 02 06 2020 14:03:05.048:INFO [SaucelabsLauncher]: Chrome 10.0 (Android) session at https://saucelabs.com/tests/54f5fb181db644a3b4779187c2309000 02 06 2020 14:03:06.869:INFO [Chrome Mobile 74.0.3729 (Android 0.0.0)]: Disconnected browser returned on socket E-bi0p0NKtghk-HcAAAO with id 85563367. Chrome Mobile 74.0.3729 (Android 0.0.0) ERROR: Error: XHR error loading http://angular-ci.local:9876/base/node_modules/rxjs/internal/operators/zip.js Error loading http://angular-ci.local:9876/base/node_modules/rxjs/internal/operators/zip.js as "../internal/operators/zip" from http://angular-ci.local:9876/base/node_modules/rxjs/operators/index.js Error: XHR error loading http://angular-ci.local:9876/base/node_modules/rxjs/internal/operators/zip.js at error (http://angular-ci.local:9876/base/node_modules/systemjs/dist/system.src.js?1c6a6c12fec50a8db7aeebe8e06e2b70135c0615:1028:16) at XMLHttpRequest.xhr.onreadystatechange [as __zone_symbol__ON_PROPERTYreadystatechange] (http://angular-ci.local:9876/base/node_modules/systemjs/dist/system.src.js?1c6a6c12fec50a8db7aeebe8e06e2b70135c0615:1036:13) at XMLHttpRequest.wrapFn (http://angular-ci.local:9876/base/dist/bin/packages/zone.js/npm_package/dist/zone.js?942d01da94828e1c75e8527fa8d06f363d6379ce:809:43) at ZoneDelegate.invokeTask (http://angular-ci.local:9876/base/dist/bin/packages/zone.js/npm_package/dist/zone.js?942d01da94828e1c75e8527fa8d06f363d6379ce:432:35) at Zone.runTask (http://angular-ci.local:9876/base/dist/bin/packages/zone.js/npm_package/dist/zone.js?942d01da94828e1c75e8527fa8d06f363d6379ce:201:55) at ZoneTask.invokeTask [as invoke] (http://angular-ci.local:9876/base/dist/bin/packages/zone.js/npm_package/dist/zone.js?942d01da94828e1c75e8527fa8d06f363d6379ce:514:38) at invokeTask (http://angular-ci.local:9876/base/dist/bin/packages/zone.js/npm_package/dist/zone.js?942d01da94828e1c75e8527fa8d06f363d6379ce:1722:18) at XMLHttpRequest.globalZoneAwareCallback (http://angular-ci.local:9876/base/dist/bin/packages/zone.js/npm_package/dist/zone.js?942d01da94828e1c75e8527fa8d06f363d6379ce:1748:21) ``` PR Close angular#37399
This comment has been minimized.
This comment has been minimized.
|
You can preview f0f319b at https://pr37231-f0f319b.ngbuilds.io/. |
|
A Googler has manually verified that the CLAs look good. (Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.) ℹ️ Googlers: Go here for more info. |
|
Regarding #37231 (comment), it is indeed a bug, tracked in angular/github-robot#51. |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
This is a backport of #36161 to the patch branch (9.1.x)
with the extra change to payload sizes for 9.1.x: 7db450e452b75133cec9c0ff76b41687e37efd6eThe payload size change is no longer necessary, so I removed it to make this identical to #36161.Thus the changes have been approved,
except for the payload size updates.This PR increases the main bundle by ~190B. See the original PR for details. It happens to push the ViewEngine payload size over the limit (actual increase: 430865B --> 431055B, while the limit is currently at 430383B).