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

An undefined value is returned by OverlayRef.detach() #7408

Closed
dherges opened this issue Sep 29, 2017 · 1 comment · Fixed by #7449
Closed

An undefined value is returned by OverlayRef.detach() #7408

dherges opened this issue Sep 29, 2017 · 1 comment · Fixed by #7449
Assignees
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@dherges
Copy link

dherges commented Sep 29, 2017

Bug, feature request, or proposal:

Bug

What is the expected behavior?

export declare class OverlayRef implements PortalHost {
    /**
     * Detaches an overlay from a portal.
     * @returns Resolves when the overlay has been detached.
     */
    detach(): Promise<any>;

What is the current behavior?

An undefined value is returned by OverlayRef.detach()

What are the steps to reproduce?

2017-09-29 10_04_41-developer tools - http___localhost_4200_

StackBlitz: https://angular-material2-issue-qqyacc.stackblitz.io/

StackBlitz export: angular-material2-issue.zip

The plunker starter btw errors with no modifications:

2017-09-29 10_17_11-developer tools - http___plnkr co_edit_o077b6ueiiigkc0s06dd_p preview

What is the use-case or motivation for changing an existing behavior?

Is it a bug?

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

@angular/cdk: 2.0.0-beta.11

Is there anything else we should know?

@josephperrott josephperrott added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent code health labels Sep 29, 2017
@devversion devversion self-assigned this Sep 30, 2017
devversion added a commit to devversion/material2 that referenced this issue Sep 30, 2017
Currently the JSDoc of the `detach` method describes that the method returns a Promise if the detaching is done. This is not the case and just `undefined` is being returned because every `PortalHost` implementation inside of the CDK is synchronously detaching the view.

In the future it might be useful to change this method back to a `Promise` in favor of animations, but for now it doesn't make sense return a `Promise` because the `attach` method is also synchronous.

Fixes angular#7408
devversion added a commit to devversion/material2 that referenced this issue Oct 1, 2017
Currently the JSDoc of the `detach` method describes that the method returns a Promise if the detaching is done. This is not the case and just `undefined` is being returned because every `PortalHost` implementation inside of the CDK is synchronously detaching the view.

In the future it might be useful to change this method back to a `Promise` in favor of animations, but for now it doesn't make sense return a `Promise` because the `attach` method is also synchronous.

Fixes angular#7408
@kara kara closed this as completed in #7449 Oct 3, 2017
@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 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants