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

bug(DomPortalOutlet): hasAttached returns false after attachComponentPortal #22370

Closed
fcostarodrigo opened this issue Mar 30, 2021 · 1 comment · Fixed by #22372
Closed

bug(DomPortalOutlet): hasAttached returns false after attachComponentPortal #22370

fcostarodrigo opened this issue Mar 30, 2021 · 1 comment · Fixed by #22372
Assignees
Labels
area: cdk/portal P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@fcostarodrigo
Copy link

Reproduction

Use StackBlitz to reproduce your issue:
https://stackblitz.com/edit/angular-ivy-b4babe?file=src/app/app.component.ts

Steps to reproduce:

  1. Attach a component portal.
  2. Call has attached method.

Expected Behavior

What behavior were you expecting to see?
Return true.

Actual Behavior

What behavior did you actually see?
Return false.

Environment

  • Angular: 11.2.7
  • CDK/Material: 11.2.6
  • Browser(s): Firefox
  • Operating System (e.g. Windows, macOS, Ubuntu): macOS
Notes

The attach works fine, the issue happens because calling attachComponentPortal directly won't set _attachedPortal and hasAttached won't work as expected. A solution would be the attachs specific methods set _attachedPortal or make the attaches methods private if they are not meant to be called.

@fcostarodrigo fcostarodrigo added the needs triage This issue needs to be triaged by the team label Mar 30, 2021
@crisbeto crisbeto self-assigned this Mar 30, 2021
crisbeto added a commit to crisbeto/material2 that referenced this issue Mar 30, 2021
…ortal methods

Fixes that the `DomPortalOutlet.hasAttached` doesn't return the correct information when the portal has been attached through the specific portal methods (e.g. `attachComponentPortal`, `attachTemplatePortal`).

Fixes angular#22370.
@crisbeto crisbeto added area: cdk/portal has pr P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent and removed needs triage This issue needs to be triaged by the team labels Mar 30, 2021
annieyw pushed a commit that referenced this issue Apr 2, 2021
…ortal methods (#22372)

Fixes that the `DomPortalOutlet.hasAttached` doesn't return the correct information when the portal has been attached through the specific portal methods (e.g. `attachComponentPortal`, `attachTemplatePortal`).

Fixes #22370.
annieyw pushed a commit that referenced this issue Apr 2, 2021
…ortal methods (#22372)

Fixes that the `DomPortalOutlet.hasAttached` doesn't return the correct information when the portal has been attached through the specific portal methods (e.g. `attachComponentPortal`, `attachTemplatePortal`).

Fixes #22370.

(cherry picked from commit 92af5f1)
@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 May 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: cdk/portal P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
2 participants