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

[snack-bar] onAction subject never completes #8181

Closed
willshowell opened this issue Nov 1, 2017 · 3 comments · Fixed by #8183
Closed

[snack-bar] onAction subject never completes #8181

willshowell opened this issue Nov 1, 2017 · 3 comments · Fixed by #8183
Assignees

Comments

@willshowell
Copy link
Contributor

Bug, feature request, or proposal:

Bug

What is the current behavior?

Subscribing to onAction() will result in a subscription that never completes unless the action button is clicked.

Expected behavior

onAction() completes when the snackbar ref is destroyed, I suppose in _finishDismiss().

Reproduction

https://stackblitz.com/edit/angular-material2-issue-l1ymh2?file=app/app.component.ts

Motivation

I wish to open a snack-bar that has a duration longer than the expected lifetime of the component opening it. When the action is clicked, I would like to navigate to a new route.

I am unable to unsubscribe from the subscription in ngOnDestroy since the snackbar action may be available after the component is destroyed.

crisbeto added a commit to crisbeto/material2 that referenced this issue Nov 1, 2017
* Completes the `onAction` observable when a snack bar is closed, no matter whether it was through an action.
* Refactors a few snack bar unit tests to use spies instead of toggling booleans.

Fixes angular#8181.
@crisbeto crisbeto self-assigned this Nov 1, 2017
@crisbeto crisbeto added the has pr label Nov 1, 2017
crisbeto added a commit to crisbeto/material2 that referenced this issue Nov 2, 2017
* Completes the `onAction` observable when a snack bar is closed, no matter whether it was through an action.
* Refactors a few snack bar unit tests to use spies instead of toggling booleans.

Fixes angular#8181.
josephperrott pushed a commit that referenced this issue Nov 10, 2017
* Completes the `onAction` observable when a snack bar is closed, no matter whether it was through an action.
* Refactors a few snack bar unit tests to use spies instead of toggling booleans.

Fixes #8181.
@AsserHamad
Copy link

There appears to already be a method which fires an action once the snackbar is destroyed (afterDismissed), but right now there's nothing to replace the old onAction command

@crisbeto
Copy link
Member

onAction is still there.

@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 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants