Skip to content
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

Merged
merged 1 commit into from
Jan 16, 2019

Conversation

crisbeto
Copy link
Member

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.

@crisbeto crisbeto added the target: patch This PR is targeted for the next patch release label Nov 12, 2018
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Nov 12, 2018
@@ -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;
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member Author

@crisbeto crisbeto Nov 17, 2018

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.

@crisbeto crisbeto force-pushed the menu-close-unsubscribe branch 2 times, most recently from 5110f6c to 34dce4f Compare November 17, 2018 09:29
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.
@crisbeto crisbeto force-pushed the menu-close-unsubscribe branch from 34dce4f to d87bcfc Compare November 17, 2018 09:44
@bene-starzengruber
Copy link

Is there already a time-plan for this issue to be released?
We are kind of dependent on it.

Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jelbourn jelbourn added pr: lgtm action: merge The PR is ready for merge by the caretaker labels Jan 8, 2019
@vivian-hu-zz vivian-hu-zz merged commit 80f510f into angular:master Jan 16, 2019
s2-abdo pushed a commit to s2-abdo/material2 that referenced this pull request Jan 18, 2019
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.
s2-abdo pushed a commit to s2-abdo/material2 that referenced this pull request Jan 18, 2019
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.
vivian-hu-zz pushed a commit that referenced this pull request Jan 18, 2019
#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-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants