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

SnackBar does not close zone when dismissed #4859

Closed
svi3c opened this issue May 29, 2017 · 4 comments · Fixed by #4860
Closed

SnackBar does not close zone when dismissed #4859

svi3c opened this issue May 29, 2017 · 4 comments · Fixed by #4860
Labels
help wanted The team would appreciate a PR from the community to address this issue P4 A relatively minor issue that is not relevant to core functions

Comments

@svi3c
Copy link
Contributor

svi3c commented May 29, 2017

Bug:

SnackBar should close duration zone when dismissed, so protractor is not blocked.

What is the expected behavior?

When calling MdSnackBarRef.prototype.dismiss(), the timeout reference by setTimeout should be cleared to close the angular zone.

What is the current behavior?

The zone stays open for the duration of the timeout.

What are the steps to reproduce?

Plunker (watch the zone state)

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

@angular/material@2.0.0-beta.5

svi3c added a commit to svi3c/material2 that referenced this issue May 29, 2017
@jelbourn jelbourn added help wanted The team would appreciate a PR from the community to address this issue P4 A relatively minor issue that is not relevant to core functions effort1: easy (hours) labels Jun 7, 2017
@jelbourn
Copy link
Member

jelbourn commented Jun 7, 2017

We should do clearTimeout for that duration timeout if the snackbar is manually dismissed before the duration completes.

@svi3c
Copy link
Contributor Author

svi3c commented Jun 7, 2017

Good point, @jelbourn.

That complicates the timeout handling:
We would have to remember the timeoutHandle. Since the ref can be directly dismissed, we would have to create either a new subject which fires on exitStart or the ref has to know about that handle.
In the latter case we cannot pass the timeout through the constructor, since we start that timeout afterOpened(), so we have to introduce a public field.

Which way do you prefer?

@jelbourn
Copy link
Member

jelbourn commented Jun 7, 2017

I would just move the setTimeout call into the snackbar ref in a function like dismissAfter(timeout), then you can keep track of the timeout id in the ref and clear it when necessary.

svi3c added a commit to svi3c/material2 that referenced this issue Jun 7, 2017
When a duration is passed to MdSnackBar.prototype.openFromComponent(),
a timeout is created. This timeout is now cleared when dismissing the
snackbar.

Fixes angular#4859
svi3c added a commit to svi3c/material2 that referenced this issue Jun 16, 2017
When a duration is passed to MdSnackBar.prototype.openFromComponent(),
a timeout is created. This timeout is now cleared when dismissing the
snackbar.

Fixes angular#4859
svi3c added a commit to svi3c/material2 that referenced this issue Jun 16, 2017
When a duration is passed to MdSnackBar.prototype.openFromComponent(),
a timeout is created. This timeout is now cleared when dismissing the
snackbar.

Fixes angular#4859
svi3c added a commit to svi3c/material2 that referenced this issue Jun 19, 2017
When a duration is passed to MdSnackBar.prototype.openFromComponent(),
a timeout is created. This timeout is now cleared when dismissing the
snackbar.

Fixes angular#4859
jelbourn pushed a commit to svi3c/material2 that referenced this issue Jun 22, 2017
When a duration is passed to MdSnackBar.prototype.openFromComponent(),
a timeout is created. This timeout is now cleared when dismissing the
snackbar.

Fixes angular#4859
jelbourn pushed a commit to svi3c/material2 that referenced this issue Jun 23, 2017
When a duration is passed to MdSnackBar.prototype.openFromComponent(),
a timeout is created. This timeout is now cleared when dismissing the
snackbar.

Fixes angular#4859
@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 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted The team would appreciate a PR from the community to address this issue P4 A relatively minor issue that is not relevant to core functions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants