-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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(dialog): close all dialogs on popstate/hashchange #2742
Conversation
src/lib/dialog/dialog.ts
Outdated
// through it. We loop through all of them and call close without assuming that | ||
// they'll be removed from the list instantaneously. | ||
this._openDialogs[i].close(); | ||
if (i > 0) { |
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.
Is this check necessary?
i--
should return zero at beginning and thewhile
would not run at all. Andi
should be always an integer from [0; X] .
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.
Not really. I'll remove it.
LGTM @vicb can you confirm that this is a reasonable thing to do? |
src/lib/dialog/dialog.ts
Outdated
// Close all of the dialogs when the user goes forwards/backwards in history or when the | ||
// location hash changes. Note that this usually doesn't include clicking on links (unless | ||
// the user is using the `HashLocationStrategy`). | ||
_location.subscribe(() => this.closeAll()); |
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.
you probably want to unsubscribe in ngOnDestroy
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.
This is inside of a service.
LGTM with un-subscription + test |
Dialog actually isn't a singleton; in apps with lazy-loading, you necessarily have multiple instances of MdDialog, which means that we need to delegate to the ancestor dialog if there is one. |
Done. |
LGTM |
5338648
to
a9ef8f1
Compare
a9ef8f1
to
3b128a3
Compare
@crisbeto Rebase? |
Can you rebase once again :) |
d032601
to
1b78613
Compare
please rebase |
1b78613
to
ccbfedc
Compare
Sorry for the delay on this one, I must've missed the notification. |
There are a number of tests failing in google because there is no provider for |
@vicb Any advice on how to handle that fact that using |
ccbfedc
to
eca455c
Compare
4abed15
to
6811780
Compare
@crisbeto The way this is currently set up I have to provide |
Closes all of the open dialogs when the user goes forwards/backwards in history. Fixes angular#2601.
6811780
to
278d635
Compare
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. |
Closes all of the open dialogs when the user goes forwards/backwards in history.
Fixes #2601.