-
Notifications
You must be signed in to change notification settings - Fork 6.8k
perf(cdk/overlay): add event listeners for overlay dispatchers outside of zone #23962
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
perf(cdk/overlay): add event listeners for overlay dispatchers outside of zone #23962
Conversation
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.
Also the CI appears to be failing.
@@ -28,7 +32,11 @@ export class OverlayKeyboardDispatcher extends BaseOverlayDispatcher { | |||
|
|||
// Lazily start dispatcher once first overlay is added | |||
if (!this._isAttached) { | |||
this._document.body.addEventListener('keydown', this._keydownListener); | |||
this._ngZone | |||
? this._ngZone.runOutsideAngular(() => |
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.
Can you use an if/else
statement here, rather than the ternary? Also can you leave an @breaking-change
note here as well? That way our tooling will pick it up when we're doing the breaking changes.
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.
Yep, done.
keydown
listener outside of zoneThere 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
Hello @arturovt, this PR was reverted because it caused an issue internally. Could you please make a new PR with this change? That we can run a fresh presubmit check, then assess how best to proceed with this. |
Hey @zarend , alright. |
…s outside of zone (angular#23962)" (angular#24353) This reverts commit e761455.
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. |
The
OverlayKeyboardDispatcher
adds akeydown
event listener, which causes Angular to run change detections on anykeydown
event, tho its listener may behave as a "noop" (e.g. if there're nokeydownEvents
observers).With these changes, the Angular zone will be re-entered only if there're any
keydownEvents
listeners.