-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
fix(menu): not unsubscribing from close stream if trigger is destroyed #14107
Conversation
@@ -85,7 +85,7 @@ export class MatMenuTrigger implements AfterContentInit, OnDestroy { | |||
private _portal: TemplatePortal; | |||
private _overlayRef: OverlayRef | null = null; | |||
private _menuOpen: boolean = false; | |||
private _closeSubscription = Subscription.EMPTY; | |||
private _closingActionsSubscription = Subscription.EMPTY; |
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.
Would it make sense to refactor this to use the takeUntil(destroyed)
pattern now? Looks like there's a few manually managed subscriptions.
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.
I did it for two one them @jelbourn. The _menuCloseSubscription
has to stay, because we have to unsubscribe from it when the menu is swapped out.
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.
Actually, I've had to revert it back to what I had initially in the PR. It seems like we have some logic that depends on us unsubscribing from these streams at the right time, which isn't only when the trigger is destroyed. It got caught by a couple of the unit tests.
5110f6c
to
34dce4f
Compare
Fixes the menu trigger not unsubscribing from the menu panel's `close` stream. In most cases it isn't an issue, because `close` gets completed when the panel is destroyed, however the user can still run into it if the trigger is destroyed, but the panel stays in place.
34dce4f
to
d87bcfc
Compare
Is there already a time-plan for this issue to be released? |
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
angular#14107) Fixes the menu trigger not unsubscribing from the menu panel's `close` stream. In most cases it isn't an issue, because `close` gets completed when the panel is destroyed, however the user can still run into it if the trigger is destroyed, but the panel stays in place.
angular#14107) Fixes the menu trigger not unsubscribing from the menu panel's `close` stream. In most cases it isn't an issue, because `close` gets completed when the panel is destroyed, however the user can still run into it if the trigger is destroyed, but the panel stays in place.
#14107) Fixes the menu trigger not unsubscribing from the menu panel's `close` stream. In most cases it isn't an issue, because `close` gets completed when the panel is destroyed, however the user can still run into it if the trigger is destroyed, but the panel stays in place.
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. |
Fixes the menu trigger not unsubscribing from the menu panel's
close
stream. In most cases it isn't an issue, becauseclose
gets completed when the panel is destroyed, however the user can still run into it if the trigger is destroyed, but the panel stays in place.